number-to-words
Advanced tools
Comparing version 1.2.2 to 1.2.3
{ | ||
"name": "number-to-words", | ||
"description": "Contains some util methods for converting numbers into words, ordinal words and ordinal numbers.", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"main": "./numberToWords.min.js", | ||
@@ -10,3 +10,4 @@ "authors": [ | ||
"contributors": [ | ||
"Aleksey Pilyugin (https://github.com/pilyugin)" | ||
"Aleksey Pilyugin (https://github.com/pilyugin)", | ||
"Jeremiah Hall (https://github.com/jeremiahrhall)" | ||
], | ||
@@ -13,0 +14,0 @@ "homepage": "https://github.com/marlun78/number-to-words", |
@@ -5,2 +5,3 @@ 'use strict'; | ||
var gulp = require('gulp'); | ||
var gutil = require('gulp-util'); | ||
var gulpPlugins = { | ||
@@ -18,3 +19,2 @@ concat: require('gulp-concat'), | ||
var EXPORT_PATTERN = /((?:module\.)?exports\s*=\s*[^,;]+;?\n?)/g; | ||
var REPLACE_WITH = ''; | ||
@@ -33,6 +33,7 @@ var files = [ | ||
return gulp.src(files) | ||
.on('error', gutil.log) | ||
.pipe(gulpPlugins.wrap({ src: 'wrapEach.tmpl' })) | ||
.pipe(gulpPlugins.replace(USE_STRICT_PATTERN, REPLACE_WITH)) | ||
.pipe(gulpPlugins.replace(REQUIRE_PATTERN, REPLACE_WITH)) | ||
.pipe(gulpPlugins.replace(EXPORT_PATTERN, REPLACE_WITH)) | ||
.pipe(gulpPlugins.replace(USE_STRICT_PATTERN, '')) | ||
.pipe(gulpPlugins.replace(REQUIRE_PATTERN, '')) | ||
.pipe(gulpPlugins.replace(EXPORT_PATTERN, '')) | ||
.pipe(gulpPlugins.concat('numberToWords.js')) | ||
@@ -39,0 +40,0 @@ .pipe(gulpPlugins.wrap({ src: 'wrapBundle.tmpl' }, pkg, { variable: 'data' })) |
/*! | ||
* Number-To-Words util | ||
* @version v1.2.2 | ||
* @version v1.2.3 | ||
* @link https://github.com/marlun78/number-to-words | ||
* @author Martin Eneqvist (https://github.com/marlun78) | ||
* @contributors Aleksey Pilyugin (https://github.com/pilyugin) | ||
* @contributors Aleksey Pilyugin (https://github.com/pilyugin),Jeremiah Hall (https://github.com/jeremiahrhall) | ||
* @license MIT | ||
@@ -18,6 +18,6 @@ */ | ||
var globalIsFinite = isFinite; | ||
var isFinite = Number.isFinite || function (value) { | ||
return typeof value === 'number' && globalIsFinite(value); | ||
}; | ||
// Simplified https://gist.github.com/marlun78/885eb0021e980c6ce0fb | ||
function isFinite(value) { | ||
return !(typeof value !== 'number' || value !== value || value === Infinity || value === -Infinity); | ||
} | ||
@@ -24,0 +24,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";function e(e){return h.test(e)||u.test(e)?e+"th":a.test(e)?e.replace(a,"ieth"):d.test(e)?e.replace(d,t):e}function t(e,t){return v[t]}function n(e){var t=parseInt(e,10);if(!s(t))throw new TypeError("Not a finite number: "+e+" ("+typeof e+")");var n=String(t),r=t%100,o=r>=11&&13>=r,i=n.charAt(n.length-1);return n+(o?"th":"1"===i?"st":"2"===i?"nd":"3"===i?"rd":"th")}function r(t,n){var r,i=parseInt(t,10);if(!s(i))throw new TypeError("Not a finite number: "+t+" ("+typeof t+")");return r=o(i),n?e(r):r}function o(e){var t,n,r=arguments[1];return 0===e?r?r.join(" ").replace(/,$/,""):"zero":(r||(r=[]),0>e&&(r.push("minus"),e=Math.abs(e)),20>e?(t=0,n=M[e]):y>e?(t=e%p,n=z[Math.floor(e/p)],t&&(n+="-"+M[t],t=0)):b>e?(t=e%y,n=o(Math.floor(e/y))+" hundred"):c>e?(t=e%b,n=o(Math.floor(e/b))+" thousand,"):g>e?(t=e%c,n=o(Math.floor(e/c))+" million,"):m>e?(t=e%g,n=o(Math.floor(e/g))+" billion,"):w>e?(t=e%m,n=o(Math.floor(e/m))+" trillion,"):x>=e&&(t=e%w,n=o(Math.floor(e/w))+" quadrillion,"),r.push(n),o(t,r))}function i(t){var n=r(t);return e(n)}var f="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||this,l=s,s=Number.isFinite||function(e){return"number"==typeof e&&l(e)},h=/(hundred|thousand|(m|b|tr|quadr)illion)$/,u=/teen$/,a=/y$/,d=/(zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)$/,v={zero:"zeroth",one:"first",two:"second",three:"third",four:"fourth",five:"fifth",six:"sixth",seven:"seventh",eight:"eighth",nine:"ninth",ten:"tenth",eleven:"eleventh",twelve:"twelfth"},p=10,y=100,b=1e3,c=1e6,g=1e9,m=1e12,w=1e15,x=9007199254740992,M=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],z=["zero","ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],$={toOrdinal:n,toWords:r,toWordsOrdinal:i};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=$),exports.numberToWords=$):f.numberToWords=$}(); | ||
!function(){"use strict";function e(e){return!("number"!=typeof e||e!==e||e===1/0||e===-(1/0))}function t(e){return h.test(e)||s.test(e)?e+"th":u.test(e)?e.replace(u,"ieth"):a.test(e)?e.replace(a,n):e}function n(e,t){return d[t]}function o(t){var n=parseInt(t,10);if(!e(n))throw new TypeError("Not a finite number: "+t+" ("+typeof t+")");var o=String(n),r=n%100,i=r>=11&&13>=r,f=o.charAt(o.length-1);return o+(i?"th":"1"===f?"st":"2"===f?"nd":"3"===f?"rd":"th")}function r(n,o){var r,f=parseInt(n,10);if(!e(f))throw new TypeError("Not a finite number: "+n+" ("+typeof n+")");return r=i(f),o?t(r):r}function i(e){var t,n,o=arguments[1];return 0===e?o?o.join(" ").replace(/,$/,""):"zero":(o||(o=[]),0>e&&(o.push("minus"),e=Math.abs(e)),20>e?(t=0,n=x[e]):p>e?(t=e%v,n=M[Math.floor(e/v)],t&&(n+="-"+x[t],t=0)):y>e?(t=e%p,n=i(Math.floor(e/p))+" hundred"):c>e?(t=e%y,n=i(Math.floor(e/y))+" thousand,"):b>e?(t=e%c,n=i(Math.floor(e/c))+" million,"):g>e?(t=e%b,n=i(Math.floor(e/b))+" billion,"):m>e?(t=e%g,n=i(Math.floor(e/g))+" trillion,"):w>=e&&(t=e%m,n=i(Math.floor(e/m))+" quadrillion,"),o.push(n),i(t,o))}function f(e){var n=r(e);return t(n)}var l="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||this,h=/(hundred|thousand|(m|b|tr|quadr)illion)$/,s=/teen$/,u=/y$/,a=/(zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)$/,d={zero:"zeroth",one:"first",two:"second",three:"third",four:"fourth",five:"fifth",six:"sixth",seven:"seventh",eight:"eighth",nine:"ninth",ten:"tenth",eleven:"eleventh",twelve:"twelfth"},v=10,p=100,y=1e3,c=1e6,b=1e9,g=1e12,m=1e15,w=9007199254740992,x=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],M=["zero","ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],z={toOrdinal:o,toWords:r,toWordsOrdinal:f};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=z),exports.numberToWords=z):l.numberToWords=z}(); |
{ | ||
"name": "number-to-words", | ||
"description": "Contains some util methods for converting numbers into words, ordinal words and ordinal numbers.", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"main": "./src", | ||
@@ -9,3 +9,4 @@ "browser": "./numberToWords.min.js", | ||
"contributors": [ | ||
"Aleksey Pilyugin (https://github.com/pilyugin)" | ||
"Aleksey Pilyugin (https://github.com/pilyugin)", | ||
"Jeremiah Hall (https://github.com/jeremiahrhall)" | ||
], | ||
@@ -18,8 +19,14 @@ "devDependencies": { | ||
"gulp-uglify": "^1.4.0", | ||
"gulp-util": "^3.0.7", | ||
"gulp-wrap": "^0.11.0", | ||
"jasmine": "^2.3.2" | ||
"http-server": "^0.9.0", | ||
"jasmine": "^2.3.2", | ||
"phantomjs-prebuilt": "^2.1.7" | ||
}, | ||
"scripts": { | ||
"build": "gulp build", | ||
"test": "jasmine" | ||
"test": "npm run test:node", | ||
"test:node": "jasmine", | ||
"test:phantom": "node_modules/phantomjs-prebuilt/bin/phantomjs node_modules/phantomjs-prebuilt/lib/phantom/examples/run-jasmine2.js 'http://localhost:3456/spec/'", | ||
"test:server": "http-server ./ -p 3456" | ||
}, | ||
@@ -26,0 +33,0 @@ "repository": { |
@@ -62,3 +62,6 @@ | ||
##### Version 1.2.2 (final 1.x release) | ||
##### Version 1.2.3 (final 1.x release) | ||
- Bug fix in `isFinite` for Phantom and IE. Thanks to @jeremiahrhall. | ||
##### Version 1.2.2 | ||
- Bug fix in `toOrdinal`. Input 11, 12, and 13 now yelds the correct suffix. Thanks to @pilyugin. | ||
@@ -65,0 +68,0 @@ |
# Number To Words — Roadmap | ||
### Version 2.0 | ||
- Rework the API | ||
- Add pluggable languages files for multi-language support | ||
- Rework the API | ||
- Add pluggable languages files for multi-language support | ||
- Remove 1.x deprecated code | ||
- Run tests with Karma |
'use strict'; | ||
var globalIsFinite = isFinite; | ||
var isFinite = Number.isFinite || function (value) { | ||
return typeof value === 'number' && globalIsFinite(value); | ||
}; | ||
// Simplified https://gist.github.com/marlun78/885eb0021e980c6ce0fb | ||
function isFinite(value) { | ||
return !(typeof value !== 'number' || value !== value || value === Infinity || value === -Infinity); | ||
} | ||
module.exports = isFinite; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35251
666
87
10