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.
numberformat
Advanced tools
Based on jquery-numberformatter, without dependency on jquery, formats numbers based on a formatting string and a locale.
Readme
Port from jquery.numberformatter, without parsing function and without dependency on jquery or jshashtable.
Originally written by Michael Abernethy (mike@abernethysoft.com), Andrew Parry (aparry0@gmail.com)
Licensed under the MIT (MIT-LICENSE.txt)
lodash.assign
formatNumber(numberString, options) - Takes a plain number as a string (e.g. '1002.0123') and returns a string of the given format options.
To achieve the old way of combining parsing and formatting to keep say a input field always formatted to a given format after it has lost focus you'd simply use a combination of the functions.
e.g.
$("#salary").blur(function(){
$(this).parseNumber({format:"#,###.00", locale:"us"});
$(this).formatNumber({format:"#,###.00", locale:"us"});
});
The syntax for the formatting is:
0 = Digit
# = Digit, zero shows as absent
. = Decimal separator
- = Negative sign
, = Grouping Separator
% = Percent (multiplies the number by 100)
For example, a format of "#,###.00" and text of 4500.20 will display as "4.500,20" with a locale of "de", and "4,500.20" with a locale of "us"
FAQs
Based on jquery-numberformatter, without dependency on jquery, formats numbers based on a formatting string and a locale.
The npm package numberformat receives a total of 48 weekly downloads. As such, numberformat popularity was classified as not popular.
We found that numberformat 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.