{"_id":"@metamask/number-to-bn","_rev":"18-343aa6669f0bbf3d9fd1163f745edbc3","name":"@metamask/number-to-bn","dist-tags":{"latest":"1.7.1"},"versions":{"1.7.1":{"name":"@metamask/number-to-bn","version":"1.7.1","keywords":["number","to","bn","convert","hex","bn.js"],"author":{"name":"Nick Dodson","email":"thenickdodson@gmail.com"},"license":"MIT","_id":"@metamask/number-to-bn@1.7.1","maintainers":[{"name":"mcmire","email":"elliot.winkler@gmail.com"},{"name":"nicholasellul","email":"nicholas.ellul1@gmail.com"},{"name":"lgbot","email":"khebkoh9@anonaddy.me"},{"name":"naugtur","email":"naugtur@gmail.com"},{"name":"ritave","email":"olaf@tomalka.me"},{"name":"danfinlay","email":"dan@danfinlay.com"},{"name":"kumavis","email":"aaron@kumavis.me"},{"name":"rekmarks","email":"rekmarks@protonmail.com"},{"name":"metamaskbot","email":"security@metamask.io"},{"name":"gudahtt","email":"markjstacey@gmail.com"},{"name":"brad.decker","email":"bhdecker84@gmail.com"},{"name":"sethkfman","email":"sethkfman@gmail.com"}],"homepage":"https://github.com/MetaMask/number-to-bn#readme","bugs":{"url":"https://github.com/MetaMask/number-to-bn/issues"},"dist":{"shasum":"a449ec8b2edba211e0dc3e1e0428ff2cc2bf7ab4","tarball":"https://registry.npmjs.org/@metamask/number-to-bn/-/number-to-bn-1.7.1.tgz","fileCount":10,"integrity":"sha512-qCN+Au4amvcVii2LdOJNndYhdmk5Lk9tlStJhKpZ8tGeYQDJTghqYXJuSUVPHvfl6FUfKY1i1Or2j2EbnEerSQ==","signatures":[{"sig":"MEUCIBcSQc35k2M+2tPIRMguv9BqVT7bfsTY2cYQsCwmI/4dAiEAl8bnZ1iHHCAAOfaAMBKN5ixmxoS/T2OrGq/KmpB9Qx4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":292152},"main":"src/index.js","engines":{"npm":">=6","node":">=8.17.0"},"gitHead":"05a1924d34b574e9140a870ec6604a1a3c49fb19","scripts":{"test":"mocha ./src/tests/**/*.js -R spec --timeout 2000000","build":"npm run build:umd && npm run build:umd:min","start":"npm test","prepare":"npm run build","release":"npmpub","prebuild":"npm run build:clean && npm run test","build:umd":"cross-env BABEL_ENV=commonjs NODE_ENV=development webpack --config ./internals/webpack/webpack.config.js --progress","coveralls":"npm run test-travis && cat ./coverage/lcov.info | coveralls","test:clean":"rimraf ./coverage","build:clean":"npm run test:clean && rimraf ./dist","build:stats":"cross-env BABEL_ENV=commonjs NODE_ENV=production webpack --config ./internals/webpack/webpack.config.js --progress --profile --json > dist/stats.json","test-travis":"node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- src/tests/**/*.js -R spec --timeout 2000000","test:browser":"zuul -- ./src/tests/*.js","build:umd:min":"cross-env BABEL_ENV=commonjs NODE_ENV=production webpack --config ./internals/webpack/webpack.config.js --progress","test:browser-local":"zuul --local -- ./src/tests/*.js"},"_npmUser":{"name":"lgbot","email":"khebkoh9@anonaddy.me"},"testling":{"files":"src/tests/*.js"},"pre-commit":"build","repository":{"url":"git+https://github.com/MetaMask/number-to-bn.git","type":"git"},"_npmVersion":"6.13.4","description":"A simple method that will convert numbers, hex, BN or bignumber.js object into a BN.js object.","directories":{},"_nodeVersion":"8.17.0","dependencies":{"bn.js":"5.2.1","strip-hex-prefix":"1.0.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"chai":"4.3.7","zuul":"3.12.0","mocha":"6.2.3","rimraf":"3.0.2","webpack":"^3.12.0","istanbul":"0.4.5","coveralls":"2.13.3","cross-env":"5.2.1","pre-commit":"1.2.2","bignumber.js":"9.1.1"},"_npmOperationalInternal":{"tmp":"tmp/number-to-bn_1.7.1_1699328890367_0.8684341277551406","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-11-07T03:48:10.290Z","modified":"2026-08-26T12:49:41.982Z","1.7.1":"2023-11-07T03:48:10.687Z"},"bugs":{"url":"https://github.com/MetaMask/number-to-bn/issues"},"author":{"name":"Nick Dodson","email":"thenickdodson@gmail.com"},"license":"MIT","homepage":"https://github.com/MetaMask/number-to-bn#readme","keywords":["number","to","bn","convert","hex","bn.js"],"repository":{"url":"git+https://github.com/MetaMask/number-to-bn.git","type":"git"},"description":"A simple method that will convert numbers, hex, BN or bignumber.js object into a BN.js object.","maintainers":[{"email":"frederik.bolding@consensys.net","name":"frederikbolding"},{"email":"metamask-npm@consensys.net","name":"metamaskbot"},{"email":"markjstacey@gmail.com","name":"gudahtt"},{"email":"maarten@zuidhoorn.com","name":"mrten"},{"email":"elliot.winkler@gmail.com","name":"mcmire"},{"email":"naugtur@gmail.com","name":"naugtur"}],"readme":"## number-to-bn\n\n<div>\n  <!-- NPM Version -->\n  <a href=\"https://www.npmjs.org/package/@metamask/number-to-bn\">\n    <img src=\"http://img.shields.io/npm/v/@metamask/number-to-bn.svg\"\n    alt=\"NPM version\" />\n  </a>\n</div>\n\n<br />\n\nA simple method to convert integer or hex integer numbers to BN.js object instances. Does not support decimal numbers.\n\n## Install\n\n```\nnpm install --save @metamask/number-to-bn\n```\n\n## Usage\n\n```js\nconst numberToBN = require('@metamask/number-to-bn');\n\nconsole.log(numberToBN('-1'));\n\n// result <BN ...> -1\n\nconsole.log(numberToBN(1));\n\n// result <BN ...> 1\n\nconsole.log(numberToBN(new BN(100)));\n\n// result <BN ...> 100\n\nconsole.log(numberToBN(new BigNumber(10000)));\n\n// result <BN ...> 10000\n\nconsole.log(numberToBN('0x0a'));\n\n// result <BN ...> 10\n\nconsole.log(numberToBN('-0x0a'));\n\n// result <BN ...> -10\n\nconsole.log(numberToBN('0.9')); // or {}, [], undefined, 9.9\n\n// throws new Error(...)\n\nconsole.log(numberToBN(null)); // or {}, [], undefined, 9.9\n\n// throws new Error(...)\n```\n\n## Important documents\n\n- [Changelog](CHANGELOG.md)\n- [License](https://raw.githubusercontent.com/MetaMask/number-to-bn/main/LICENSE)\n\n## Licence\n\nThis project is licensed under the MIT license, Copyright (c) 2016 Nick Dodson. For more information see LICENSE.md.\n\n```\nThe MIT License\n\nCopyright (c) 2016 Nick Dodson. nickdodson.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```\n","readmeFilename":"README.md"}