sigfig
Version:
Round a number to n significant figures.
59 lines • 1.98 kB
JSON
{
"name": "sigfig",
"version": "1.0.2",
"description": "Round a number to n significant figures.",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/leonzalion/sigfig.git"
},
"homepage": "https://github.com/leonzalion/sigfig#readme",
"author": {
"name": "Leon Si",
"email": "contact@leonzalion.com",
"url": "https://leonzalion.com"
},
"type": "module",
"exports": {
"import": "./index.js",
"require": "./index.cjs"
},
"devDependencies": {
"@leonzalion/configs": "^1.2.25",
"desm": "^1.2.0",
"eslint-define-config": "^1.4.0",
"execa": "^6.1.0",
"fast-check": "^2.24.0",
"lion-system": "^1.3.16",
"tsc-alias": "^1.6.6",
"typescript": "^4.6.3",
"vitest": "^0.9.4"
},
"dependencies": {
"from-exponential": "^1.1.1"
},
"publishConfig": {
"directory": "dist"
},
"keywords": [
"significant",
"figures",
"round",
"scientific",
"precision",
"rounding",
"number",
"decimal",
"places"
],
"scripts": {
"release": "lionp",
"build": "node-ts ./scripts/build.ts",
"start": "node-ts ./src/index.ts",
"test": "vitest run",
"lint": "eslint --cache --fix .",
"prettier": "prettier --write .",
"tc": "tsc --noEmit"
},
"readme": "# sigfig\n\n[](https://npmjs.com/package/sigfig)\n\nRetrieve the amount of significant figures in a number or round a number to a certain amount of significant figures.\n\n## Usage\n\n```javascript\nimport sigfig from 'sigfig';\n\nsigfig('9.9', 1); // \"10\"\nsigfig('3.10194', 4); // \"3.102\"\nsigfig('3.10194', 7); // \"3.101940\"\nsigfig('0.00023224', 4); // \"0.0002322\"\n\n// When called without a second argument, it returns the number of\n// significant figures provided in the number passed as the first argument:\nsigfig('9.9'); // 2\nsigfig('3.10194'); // 6\nsigfig('0.00023224'); // 5\n```\n"
}