Number formatting (add comma and decimal in correct places)


#1

hi,
i am looking for a package that would convert numbers to correct comma and decimal points while making inputs.
For example input of 1200 would automatically on the fly insert the comma+decimal and format it to 1,200.00 .
Please advise if someone has already created a plugin with such features or would be interested in helping create one.


#2

There is add-commas which may work. comma-it may also work.


#3

hi,
i am a little new to this.
the 2 options you provided me are NPM packages.
I just now installed NPM along with the comma-it using the commands below:-

apt get install npm
npm install comma-it

How do I get the comma-it to work with Atom.io ?
Appreciate if you could help, meanwhile I i will try to do some research on my own.


#4

npm --save install commit-it is probably good. I believe you can also use apm --save install commit-it but I haven’t tested that one. You may also have to apm rebuild once you install it via npm.

Once you get it in, just require it and see if it works.


#5

hi,
I not at all familiar with Node.js and Atom.io so I struggling a bit.
Would it be possible to just download the comma-it package and then directly copy into the /.atom/packages folder?
Would that work?


#6

i tried to run the package manager with the following commands:-
npm --save install commit-it

I got some errors :-

 npm ERR!     at /usr/lib/nodejs/graceful-fs/polyfills.js:133:7
npm ERR!     at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 3.19.0-32-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "--save" "install" "commit-it"
npm ERR! cwd /home/om/.atom/packages
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! type non_object_property_load
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/om/.atom/packages/npm-debug.log
npm ERR! not ok code 0

#7

@kev911 Neither of them are Atom packages. There is no quick and easy way to make them work in Atom. You would have to:

  1. Build an Atom package
  2. Include one of these Node modules in the Atom package you created

See the Atom Flight Manual for more details:

http://flight-manual.atom.io/hacking-atom/sections/package-modifying-text/