finciero-sanitize
v0.0.1
Published
Sanitize module to generate clean string and formating number
Downloads
2
Readme
Sanitize module
Install
$ npm install sanitize --save
sanitize
Useful functions to clean strings and numbers.
- sanitize
- .cleanString(str) ⇒ String
- .formatNumberNat(number) ⇒ Integer
- .formatNumberInt(number) ⇒ Float
- .formatNumberInt2(number) ⇒ Float
- .capitalize(str) ⇒ String
- .phraseCapitalize(phrase) ⇒ String
Sanitize.cleanString(str) ⇒ String
Delete extra space from text
Returns: String - cleaned string
Sanitize.formatNumberNat(number) ⇒ Integer
Format String of number and transform it into Integer
Returns: Integer - String only with number returned as Integer
Example
> var number = '10.000'
> formatNumberNat(number)
10000
Sanitize.formatNumberInt(number) ⇒ Float
Format String of number and transform it into Float
Returns: Float - String only with number returned as Float
Example
> var number = '10.000,10'
> formatNumberInt(number)
10000.1
Sanitize.formatNumberInt2(number) ⇒ Float
Format String of number and transform it into Float
Returns: Float - String only with number returned as Float
Example
> var number = '10,000.10'
> formatNumberInt(number)
10000.1
Sanitize.capitalize(str) ⇒ String
Capitalize a word
Returns: String - Capitalized string
Sanitize.phraseCapitalize(phrase) ⇒ String
Capitalize a whole text
Returns: String - Capitalized text
--
documented by jsdoc-to-markdown.
© 2015 Rodrigo Fuenzalida [email protected]