Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vukanac/number-formatter
A npm package for number-formatter example
https://github.com/vukanac/number-formatter
javascript npm npm-module npm-package
Last synced: 12 days ago
JSON representation
A npm package for number-formatter example
- Host: GitHub
- URL: https://github.com/vukanac/number-formatter
- Owner: vukanac
- License: mit
- Created: 2019-02-04T14:44:15.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-24T07:55:00.000Z (over 5 years ago)
- Last Synced: 2024-11-29T12:46:48.497Z (23 days ago)
- Topics: javascript, npm, npm-module, npm-package
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Number Formatter (this is only a NPM Demo)
[![GitHub version](https://badge.fury.io/gh/vukanac%2Fnumber-formatter.svg)](https://badge.fury.io/gh/vukanac%2Fnumber-formatter)
[![Build Status](https://travis-ci.org/vukanac/number-formatter.svg?branch=master)](https://travis-ci.org/vukanac/number-formatter)
[![Coverage Status](https://coveralls.io/repos/github/vukanac/number-formatter/badge.svg?branch=master)](https://coveralls.io/github/vukanac/number-formatter?branch=master)
[![npm version](https://badge.fury.io/js/%40vukanac%2Fnumber-formatter.svg)](https://badge.fury.io/js/%40vukanac%2Fnumber-formatter)A small library that adds commas to numbers
## Installation
npm install @vukanac/number-formatter
## Usage
var numFormatter = require('@vukanac/number-formatter');
var formattedNum = numFormatter(35666);
Output should be `35,666`
## Tests
npm test
## Contributing
All new functionality or changes must be linted and covered with unit tests.
npm run lint
npm testSteps done:
git init
git push origin
npm login
npm publish
npm install --save
npm unpublishSupporting steps:
hub create
travis init
travis enable
npx eslint --init## Troubleshooting
npm publish
Required one time password (OTP) from 2FA enabled accounts.
It the result is:
npm ERR! 402 Payment Required
- PUT https://registry.npmjs.org/@%2fnumber-formatter
- You must sign up for private packagesRun:
npm publish --access=public
or change the scope from private (organisation) based on your username
to the global scope by changing the name in `package.json`:- "name": "@/number-formatter",
+ "name": "number-formatter-with-locale",## Update NPM version
> The only way to update npm is to release a new version.
`npm` will not allow you to re-publish to the same version number.
With:
npm version (patch|minor|major) -m ""
npm version patch -m "Version %s - add sweet badges"
`%s` = the new version number,
will create a new release by bumping the version in your `package.json`,
add a new commit and tag it with this release number.> Note: Your Git working directory has to be clean before you can run `npm version`.
After bumping the version number
git push --tags
npm publish### Autobump version with commit message (properly written)
To write commit message with correct triggers use `commitlint`:
npm install @commitlint/cli @commitlint/config-conventional
echo 'foo: bar' | commitlint
commitlint --from=HEAD~1