Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
jp-numerals
Advanced tools
Readme
Convert numbers into Japanese rank format (e.g. 123455 => 12_万_3455)
inspired from number-to-chinise-words
npm install jp-numerals
Or,
yarn add jp-numerals
const formatter = require('jp-numerals')
// or import { numerals } from 'jp-numerals'
const n = formatter.numerals(123456789)
n.toString()
// => returns
'1億2345万6789'
n.toTuples()
// => returns
[
[1, '億'],
[2345, '万'],
[6789, '']
]
n.toNumeralObjs()
// => returns
[
{ unit: 2, character: '億', rank: 2, digits: 1 },
{ unit: 1, character: '万', rank: 1, digits: 2345 },
{ unit: 0, character: '', rank: 0, digits: 6789 }
]
n.toNumerals()
// => returns
[
Numeral { raw: 123456789, unit: 2 },
Numeral { raw: 123456789, unit: 1 },
NumeralZero { raw: 123456789, unit: 0 }
]
import {numerals} from 'jp-numerals';
const n = numerals(12_3456_7890)
n.round(JpNumeralUnit.億).toString()
// => returns
'12億'
import {numerals} from 'jp-numerals';
const n = numerals(-123456789)
n.sign()
// => returns -1
n.toSignedString()
// => returns '-1億2345万6789'
n.toSignedNumeralObjs()
// => returns
[
-1,
[
{ unit: 2, character: '億', rank: 2, digits: 1 },
{ unit: 1, character: '万', rank: 1, digits: 2345 },
{ unit: 0, character: '', rank: 0, digits: 6789 }
]
]
npm test
npm run test:watch
npm run test:prod
Do not use regular git commit
for semantic release.
Instead:
npm run commit
This library is based on typescript-library-starter
FAQs
Convert numbers into Japanese rank format (e.g. 123455 => 12_万_3455)
The npm package jp-numerals receives a total of 160 weekly downloads. As such, jp-numerals popularity was classified as not popular.
We found that jp-numerals demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.