Gathering detailed insights and metrics for number-to-bn
Gathering detailed insights and metrics for number-to-bn
Gathering detailed insights and metrics for number-to-bn
Gathering detailed insights and metrics for number-to-bn
Converts a number to a BN.js object, throw if invalid number.
npm install number-to-bn
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
4 Stars
9 Commits
12 Forks
3 Watching
2 Branches
1 Contributors
Updated on 26 May 2023
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-9.6%
81,279
Compared to previous day
Last week
4.4%
491,637
Compared to previous week
Last month
5.3%
1,974,730
Compared to previous month
Last year
-10.3%
21,517,144
Compared to previous year
2
A simple method to convert integer or hex integer numbers to BN.js object instances. Does not supprot decimal numbers.
npm install --save number-to-bn
1const numberToBN = require('number-to-bn'); 2 3console.log(numberToBN('-1')); 4 5// result <BN ...> -1 6 7console.log(numberToBN(1)); 8 9// result <BN ...> 1 10 11console.log(numberToBN(new BN(100))); 12 13// result <BN ...> 100 14 15console.log(numberToBN(new BigNumber(10000))); 16 17// result <BN ...> 10000 18 19console.log(numberToBN('0x0a')); 20 21// result <BN ...> 10 22 23console.log(numberToBN('-0x0a')); 24 25// result <BN ...> -10 26 27console.log(numberToBN('0.9')); // or {}, [], undefined, 9.9 28 29// throws new Error(...) 30 31console.log(numberToBN(null)); // or {}, [], undefined, 9.9 32 33// throws new Error(...)
This project is licensed under the MIT license, Copyright (c) 2016 Nick Dodson. For more information see LICENSE.md.
The MIT License
Copyright (c) 2016 Nick Dodson. nickdodson.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/9 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More