
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@lorefnon/currency-in-words
Advanced tools
A light-weight, fast and efficient lib that converts currency or any numbers to corresponding words
Convert currency or similar number formats to respective words
npm i currency-in-words
import { convert } from 'currency-in-words'
/*
* IOptions {
* format?: 'intl' | 'in'
* lang?: 'en'
* }
*
* convert(value: string, {format: 'intl', lang: 'en'}?: IOptions) => string
*/
// indian-system
const inWords1 = convert('555.77')
// international-system
const inWords2 = convert('777.55', { format: 'intl' })
console.log(convert('555')) // five hundred fifty five
console.log(convert('1022')) // one thousand twenty two
console.log(convert('1,022')) // NaN
console.log(convert('66.123')) // sixty six.twelve
console.log(convert('99.11')) // ninety nine.eleven
console.log(convert('99.09')) // ninety nine; decimals lesser than .10 is rejected
console.log(convert(100000)) // one lakh
console.log(convert(100000, { format: 'int' })) // one hundred thousand
Note
- Expect
NaN
when any invalid characters are present, eg: 10E55- Fractional part is corrected to two decimal places
- Decimals from .00 to .09 is ignored.
Supports upto 15 digits for both indian and international systems on their integer part. A RangeError will be thrown for length beyond 15.
eg: calling convert with 999,999,999,999,999 + 1 will throw a range error
International system:
999,999,999,999,999 (1 quadrillion - 1)
Indian system:
99,99,99,99,99,99,999 (100 crore crore - 1)
const amount = 0.99
const result = convert(`${amount}`) // zero.ninety nine
const amount = '1,000.99'
const sanitized = amount.replace(/,/, '') // 1000.99
const amount = '123.123'
const [dollars, cents] = amount.split('.')
const result = `${convert(dollars)}.${convert(cents)}` // one hundred twenty threee.one hundred twenty three
FAQs
A light-weight, fast and efficient lib that converts currency or any numbers to corresponding words
The npm package @lorefnon/currency-in-words receives a total of 30 weekly downloads. As such, @lorefnon/currency-in-words popularity was classified as not popular.
We found that @lorefnon/currency-in-words demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.