{"_id":"@codecompose/words-to-numbers","_rev":"3-72087482e167f073bb77cee025383c89","name":"@codecompose/words-to-numbers","dist-tags":{"latest":"2.0.1","next":"2.0.0-0"},"versions":{"1.6.0":{"name":"@codecompose/words-to-numbers","description":"convert textual words to numbers with optional fuzzy text matching","version":"1.6.0","license":"MIT","options":{"mocha":"--require scripts/mocha_runner src/**/__tests__/**/*.js"},"main":"dist/index.js","types":"./index.d.ts","publishConfig":{"access":"public"},"scripts":{"start":"babel --watch --plugins \"transform-runtime\" src --ignore __tests__ --out-dir ./dist","prepare":"babel --plugins \"transform-runtime\" src --ignore __tests__ --out-dir ./dist","lint":"eslint ./src","lintfix":"eslint ./src --fix","testonly":"mocha $npm_package_options_mocha","test":"npm run lint && npm run testonly","test-watch":"npm run testonly -- --watch --watch-extensions js"},"devDependencies":{"babel-cli":"6.x.x","babel-core":"6.x.x","babel-eslint":"4.x.x","babel-plugin-transform-runtime":"6.x.x","babel-polyfill":"6.x.x","babel-preset-es2015":"6.x.x","babel-preset-stage-2":"6.x.x","chai":"3.x.x","eslint":"1.7.x","eslint-plugin-babel":"2.x.x","its-set":"^1.1.5","mocha":"2.x.x","nodemon":"1.7.x"},"author":{"name":"Finn Fitzsimons","email":"hello@finn.works"},"repository":{"type":"git","url":"git+https://github.com/0x80/words-to-numbers.git"},"dependencies":{"babel-runtime":"6.x.x","clj-fuzzy":"^0.3.2","its-set":"^1.1.5"},"_id":"@codecompose/words-to-numbers@1.6.0","gitHead":"9c7030e550e2fe8a77ec812d06752313106313be","bugs":{"url":"https://github.com/0x80/words-to-numbers/issues"},"homepage":"https://github.com/0x80/words-to-numbers#readme","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-11KDMcLPc7Ie6f4H9H7HDdl5AIqiIcUv3k1Bv6a+otqAleIC3D7Rr0iSa3NRZ/odXMd3YUC3o4c/hpQhn4RvHQ==","shasum":"7c586322ffe7187e3a91c2b20a1ca71406137ed3","tarball":"https://registry.npmjs.org/@codecompose/words-to-numbers/-/words-to-numbers-1.6.0.tgz","fileCount":10,"unpackedSize":23954,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC3DVQcoJpPgBJmPT94tLBbriZDi+wtzBuAVFDr9/nnzAiBinA7pSWLSdyPwcRmIrjizpXG5dVwMy10X9HFUaq8Q+Q=="}]},"_npmUser":{"name":"thijskoerselman","email":"thijskoerselman@gmail.com"},"directories":{},"maintainers":[{"name":"thijskoerselman","email":"thijskoerselman@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/words-to-numbers_1.6.0_1708019472239_0.8170841507168278"},"_hasShrinkwrap":false},"2.0.0-0":{"name":"@codecompose/words-to-numbers","description":"Convert textual words to numbers with optional fuzzy text matching","version":"2.0.0-0","license":"MIT","type":"module","main":"./src/index.js","types":"./index.d.ts","devDependencies":{"eslint":"8.56.0","eslint-config-0x80":"^0.0.0","prettier":"^3.2.5","typescript":"^5.3.3","vitest":"^1.3.1"},"author":{"name":"Finn Fitzsimons","email":"hello@finn.works"},"repository":{"type":"git","url":"git+https://github.com/0x80/words-to-numbers.git"},"dependencies":{"clj-fuzzy":"^0.4.1","its-set":"^1.1.5"},"scripts":{"lint":"eslint .","test":"vitest ./src","format":"prettier --write ."},"readme":"# Words To Numbers\n\nThis repository was forked from\n[words-from-numbers](https://github.com/finnfiddle/words-to-numbers) because the\nproject seems abandoned. This fork:\n\n- Fixes the manifest and makes it a pure ESM package\n- Removes old dependencies and Babel transpilation\n- Uses Vitest to replace old testing tools\n- Upgrades clj-fuzzy to latest version\n- Add prettier formatting\n- Replace NPM with PNPM\n- Add basis for Typescript conversion\n\nI might convert the code to Typescript later. PRs are welcome.\n\n## Usage\n\n```\nnpm install words-to-numbers\n```\n\nIf the whole string passed is a number then it will return a `Number` type\notherwise it will return the original string with all instances of numbers\nreplaced.\n\nTODO: Add functionality for parsing mixed numbers and words. PRs welcome.\n\n## Basic Examples\n\n```javascript\nimport wordsToNumbers from \"words-to-numbers\";\nwordsToNumbers(\"one hundred\"); //100\nwordsToNumbers(\"one hundred and five\"); //105\nwordsToNumbers(\"one hundred and twenty five\"); //125\nwordsToNumbers(\"four thousand and thirty\"); //4030\nwordsToNumbers(\"six million five thousand and two\"); //6005002\nwordsToNumbers(\"a thousand one hundred and eleven\"); //1111\nwordsToNumbers(\"twenty thousand five hundred and sixty nine\"); //20569\nwordsToNumbers(\"five quintillion\"); //5000000000000000000\nwordsToNumbers(\"one-hundred\"); //100\nwordsToNumbers(\"one-hundred and five\"); //105\nwordsToNumbers(\"one-hundred and twenty-five\"); //125\nwordsToNumbers(\"four-thousand and thirty\"); //4030\nwordsToNumbers(\"six-million five-thousand and two\"); //6005002\nwordsToNumbers(\"a thousand, one-hundred and eleven\"); //1111\nwordsToNumbers(\"twenty-thousand, five-hundred and sixty-nine\"); //20569\n```\n\n## Multiple numbers in a string\n\nReturns a string with all instances replaced.\n\n```javascript\nwordsToNumbers('there were twenty-thousand, five-hundred and sixty-nine X in the five quintillion Y')) // 'there were 20569 X in the 5000000000000000000 Y'\n```\n\n## With Fuzzy Matching\n\nUses\n[Jaro distance](http://yomguithereal.github.io/clj-fuzzy/javascript.html#jaro)\nto find the best match for the number words. Don't rely on this being completely\naccurate...\n\n```javascript\nimport wordsToNumbers from \"words-to-numbers\";\nwordsToNumbers(\"won huntred\", { fuzzy: true }); //100\nwordsToNumbers(\"too thousant and fiev\", { fuzzy: true }); //2005\nwordsToNumbers(\"tree millyon sefen hunderd and twinty sex\", { fuzzy: true }); //3000726\n```\n\n## Decimal Points\n\n```javascript\nimport wordsToNumbers from \"words-to-numbers\";\nwordsToNumbers(\"ten point five\"); //10.5\nwordsToNumbers(\"three point one four one five nine two six\"); //3.1415926\n```\n\n## Ordinal Numbers\n\n```javascript\nimport wordsToNumbers from \"words-to-numbers\";\nwordsToNumbers(\"first\"); //1\nwordsToNumbers(\"second\"); //2\nwordsToNumbers(\"third\"); //3\nwordsToNumbers(\"fourteenth\"); //14\nwordsToNumbers(\"twenty fifth\"); //25\nwordsToNumbers(\"thirty fourth\"); //34\nwordsToNumbers(\"forty seventh\"); //47\nwordsToNumbers(\"fifty third\"); //53\nwordsToNumbers(\"sixtieth\"); //60\nwordsToNumbers(\"seventy second\"); //72\nwordsToNumbers(\"eighty ninth\"); //89\nwordsToNumbers(\"ninety sixth\"); //96\nwordsToNumbers(\"one hundred and eighth\"); //108\nwordsToNumbers(\"one hundred and tenth\"); //110\nwordsToNumbers(\"one hundred and ninety ninth\"); //199\n```\n\n## Implied Hundreds\n\n```javascript\nwordsToNumbers(\"nineteen eighty four\", { impliedHundreds: true }); //1984\nwordsToNumbers(\"one thirty\", { impliedHundreds: true }); //130\nwordsToNumbers(\"six sixty two\", { impliedHundreds: true }); //662\nwordsToNumbers(\"ten twelve\", { impliedHundreds: true }); //1012\nwordsToNumbers(\"nineteen ten\", { impliedHundreds: true }); //1910\nwordsToNumbers(\"twenty ten\", { impliedHundreds: true }); //2010\nwordsToNumbers(\"twenty seventeen\", { impliedHundreds: true }); //2017\nwordsToNumbers(\"twenty twenty\", { impliedHundreds: true }); //2020\nwordsToNumbers(\"twenty twenty one\", { impliedHundreds: true }); //2021\nwordsToNumbers(\"fifty sixty three\", { impliedHundreds: true }); //5063\nwordsToNumbers(\"fifty sixty\", { impliedHundreds: true }); //5060\nwordsToNumbers(\"fifty sixty three thousand\", { impliedHundreds: true }); //5063000\nwordsToNumbers(\"one hundred thousand\", { impliedHundreds: true }); //100000\n```\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/0x80/words-to-numbers/issues"},"homepage":"https://github.com/0x80/words-to-numbers#readme","_id":"@codecompose/words-to-numbers@2.0.0-0","_integrity":"sha512-kWL5Zq1eyKqsnEI92crWB7Y3G8h46mME4Zg1eZk2+7PWrsL4Sn0ehlj326H4zRSgLVv7+TMXumr8sCEVDoGm9Q==","_resolved":"/private/var/folders/tt/2t2tbx8d6f7_ph4c54m369jw0000gn/T/ff9a93039944c31855b6ff71a2e4d582/codecompose-words-to-numbers-2.0.0-0.tgz","_from":"file:codecompose-words-to-numbers-2.0.0-0.tgz","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-kWL5Zq1eyKqsnEI92crWB7Y3G8h46mME4Zg1eZk2+7PWrsL4Sn0ehlj326H4zRSgLVv7+TMXumr8sCEVDoGm9Q==","shasum":"6ef4a96f22ff022c0927c88b5e072e3d5e081dd5","tarball":"https://registry.npmjs.org/@codecompose/words-to-numbers/-/words-to-numbers-2.0.0-0.tgz","fileCount":11,"unpackedSize":28157,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDIg+wFSxJtW8RuwR9pnYcaRamLFhlEd7eEhtAbRmOaSQIgbOK4aWKbyZYaN2/MyMGuUrwF9ZJfw8V3GN68I/Bdgvs="}]},"_npmUser":{"name":"thijskoerselman","email":"thijskoerselman@gmail.com"},"directories":{},"maintainers":[{"name":"thijskoerselman","email":"thijskoerselman@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/words-to-numbers_2.0.0-0_1708637769427_0.38293564488676535"},"_hasShrinkwrap":false},"2.0.0":{"name":"@codecompose/words-to-numbers","description":"Convert textual words to numbers with optional fuzzy text matching","version":"2.0.0","license":"MIT","type":"module","main":"./src/index.js","types":"./index.d.ts","devDependencies":{"eslint":"8.56.0","eslint-config-0x80":"^0.0.0","prettier":"^3.2.5","typescript":"^5.3.3","vitest":"^1.3.1"},"author":{"name":"Finn Fitzsimons","email":"hello@finn.works"},"repository":{"type":"git","url":"git+https://github.com/0x80/words-to-numbers.git"},"dependencies":{"clj-fuzzy":"^0.4.1","its-set":"^1.1.5"},"scripts":{"lint":"eslint .","test":"vitest ./src","format":"prettier --write ."},"bugs":{"url":"https://github.com/0x80/words-to-numbers/issues"},"homepage":"https://github.com/0x80/words-to-numbers#readme","_id":"@codecompose/words-to-numbers@2.0.0","_integrity":"sha512-BfeMdUoDLBUv2IrNibNlQrB3xoG1RGu1Wad3uCQBjNkzlQt96svrpJTMsfKxTQrjzdUpWBduokIwajR8u5+Rkw==","_resolved":"/private/var/folders/tt/2t2tbx8d6f7_ph4c54m369jw0000gn/T/0453aa4f002437973cfedbfabfce09cc/codecompose-words-to-numbers-2.0.0.tgz","_from":"file:codecompose-words-to-numbers-2.0.0.tgz","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-BfeMdUoDLBUv2IrNibNlQrB3xoG1RGu1Wad3uCQBjNkzlQt96svrpJTMsfKxTQrjzdUpWBduokIwajR8u5+Rkw==","shasum":"13c728d6c861a50870f3bb3467bd260b354151b9","tarball":"https://registry.npmjs.org/@codecompose/words-to-numbers/-/words-to-numbers-2.0.0.tgz","fileCount":11,"unpackedSize":28729,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAzQ7B2G0MNkHc+2ZDWFaOnwoFBCUmsvRgjfKI9lJl5iAiBdJMR2EU//tBEoy4uMaHnXoQ+XFie9AyFywBYXH35vdA=="}]},"_npmUser":{"name":"thijskoerselman","email":"thijskoerselman@gmail.com"},"directories":{},"maintainers":[{"name":"thijskoerselman","email":"thijskoerselman@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/words-to-numbers_2.0.0_1708676680470_0.08792602119456894"},"_hasShrinkwrap":false},"2.0.1":{"name":"@codecompose/words-to-numbers","description":"Convert textual words to numbers with optional fuzzy text matching","version":"2.0.1","license":"MIT","type":"module","main":"./src/index.js","types":"./index.d.ts","devDependencies":{"eslint":"8.56.0","eslint-config-0x80":"^0.0.0","prettier":"^3.2.5","typescript":"^5.3.3","vitest":"^1.3.1"},"author":{"name":"Finn Fitzsimons","email":"hello@finn.works"},"repository":{"type":"git","url":"git+https://github.com/0x80/words-to-numbers.git"},"dependencies":{"clj-fuzzy":"^0.4.1","its-set":"^1.1.5"},"scripts":{"lint":"eslint .","test":"vitest ./src","format":"prettier --write ."},"bugs":{"url":"https://github.com/0x80/words-to-numbers/issues"},"homepage":"https://github.com/0x80/words-to-numbers#readme","_id":"@codecompose/words-to-numbers@2.0.1","_integrity":"sha512-FSWMZ/d9T5omivNSqrS/44EHSnU8yFgLN8uLcGvikVUsoc5OWD76Ya5bOmalIxPvkr8tZlsXWT1HSPNMsCcsXg==","_resolved":"/private/var/folders/tt/2t2tbx8d6f7_ph4c54m369jw0000gn/T/e96e700d5ec3794fb9a5cbeb3cbb91a3/codecompose-words-to-numbers-2.0.1.tgz","_from":"file:codecompose-words-to-numbers-2.0.1.tgz","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-FSWMZ/d9T5omivNSqrS/44EHSnU8yFgLN8uLcGvikVUsoc5OWD76Ya5bOmalIxPvkr8tZlsXWT1HSPNMsCcsXg==","shasum":"1ab715040d99131fbfec050124801a4fdeebfeeb","tarball":"https://registry.npmjs.org/@codecompose/words-to-numbers/-/words-to-numbers-2.0.1.tgz","fileCount":11,"unpackedSize":28769,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFqpt7ov+MCSi2puA1hBBZ+h4qMGO9KBTm1qKhcdxL5NAiEA+z17mnpkI7S+ILo0UpUEhs1xt4X90knq4OLtK4C4LQ8="}]},"_npmUser":{"name":"thijskoerselman","email":"thijskoerselman@gmail.com"},"directories":{},"maintainers":[{"name":"thijskoerselman","email":"thijskoerselman@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/words-to-numbers_2.0.1_1709885550553_0.5713832740271065"},"_hasShrinkwrap":false}},"time":{"created":"2024-02-15T17:51:12.167Z","1.6.0":"2024-02-15T17:51:12.385Z","modified":"2024-03-08T08:12:31.141Z","2.0.0-0":"2024-02-22T21:36:09.627Z","2.0.0":"2024-02-23T08:24:40.649Z","2.0.1":"2024-03-08T08:12:30.706Z"},"maintainers":[{"name":"thijskoerselman","email":"thijskoerselman@gmail.com"}],"description":"Convert textual words to numbers with optional fuzzy text matching","homepage":"https://github.com/0x80/words-to-numbers#readme","repository":{"type":"git","url":"git+https://github.com/0x80/words-to-numbers.git"},"author":{"name":"Finn Fitzsimons","email":"hello@finn.works"},"bugs":{"url":"https://github.com/0x80/words-to-numbers/issues"},"license":"MIT","readme":"# Words To Numbers\n\nThis repository was forked from\n[words-from-numbers](https://github.com/finnfiddle/words-to-numbers) because the\nproject seems abandoned.\n\nThe codebase was modernized and published under 2.0 with the following changes:\n\n- Fix the invalid package manifest\n- Remove transpilation and make it\n  [pure ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)\n- Add Typescript\n  [type inference](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html)\n- Remove obsolete and old dependencies\n- Use Vitest to replace older testing tools\n- Upgrade clj-fuzzy to latest version\n- Add prettier formatting\n- Use PNPM as package manager\n\nI might convert the code to Typescript later, but the code quality is pretty bad\nand I am not sure it's worth it. PRs are welcome.\n\nI have also replaced NPM with PNPM, which was unnecessary but just personal\npreference.\n\n## Usage\n\n```\nnpm install @codecompose/words-to-numbers\n```\n\nIf the whole string passed is a number then it will return a `Number` type\notherwise it will return the original string with all instances of numbers\nreplaced.\n\nTODO: Add functionality for parsing mixed numbers and words. PRs welcome.\n\n## Basic Examples\n\n```javascript\nimport wordsToNumbers from \"words-to-numbers\";\nwordsToNumbers(\"one hundred\"); //100\nwordsToNumbers(\"one hundred and five\"); //105\nwordsToNumbers(\"one hundred and twenty five\"); //125\nwordsToNumbers(\"four thousand and thirty\"); //4030\nwordsToNumbers(\"six million five thousand and two\"); //6005002\nwordsToNumbers(\"a thousand one hundred and eleven\"); //1111\nwordsToNumbers(\"twenty thousand five hundred and sixty nine\"); //20569\nwordsToNumbers(\"five quintillion\"); //5000000000000000000\nwordsToNumbers(\"one-hundred\"); //100\nwordsToNumbers(\"one-hundred and five\"); //105\nwordsToNumbers(\"one-hundred and twenty-five\"); //125\nwordsToNumbers(\"four-thousand and thirty\"); //4030\nwordsToNumbers(\"six-million five-thousand and two\"); //6005002\nwordsToNumbers(\"a thousand, one-hundred and eleven\"); //1111\nwordsToNumbers(\"twenty-thousand, five-hundred and sixty-nine\"); //20569\n```\n\n## Multiple numbers in a string\n\nReturns a string with all instances replaced.\n\n```javascript\nwordsToNumbers('there were twenty-thousand, five-hundred and sixty-nine X in the five quintillion Y')) // 'there were 20569 X in the 5000000000000000000 Y'\n```\n\n## With Fuzzy Matching\n\nUses\n[Jaro distance](http://yomguithereal.github.io/clj-fuzzy/javascript.html#jaro)\nto find the best match for the number words. Don't rely on this being completely\naccurate...\n\n```javascript\nimport wordsToNumbers from \"words-to-numbers\";\nwordsToNumbers(\"won huntred\", { fuzzy: true }); //100\nwordsToNumbers(\"too thousant and fiev\", { fuzzy: true }); //2005\nwordsToNumbers(\"tree millyon sefen hunderd and twinty sex\", { fuzzy: true }); //3000726\n```\n\n## Decimal Points\n\n```javascript\nimport wordsToNumbers from \"words-to-numbers\";\nwordsToNumbers(\"ten point five\"); //10.5\nwordsToNumbers(\"three point one four one five nine two six\"); //3.1415926\n```\n\n## Ordinal Numbers\n\n```javascript\nimport wordsToNumbers from \"words-to-numbers\";\nwordsToNumbers(\"first\"); //1\nwordsToNumbers(\"second\"); //2\nwordsToNumbers(\"third\"); //3\nwordsToNumbers(\"fourteenth\"); //14\nwordsToNumbers(\"twenty fifth\"); //25\nwordsToNumbers(\"thirty fourth\"); //34\nwordsToNumbers(\"forty seventh\"); //47\nwordsToNumbers(\"fifty third\"); //53\nwordsToNumbers(\"sixtieth\"); //60\nwordsToNumbers(\"seventy second\"); //72\nwordsToNumbers(\"eighty ninth\"); //89\nwordsToNumbers(\"ninety sixth\"); //96\nwordsToNumbers(\"one hundred and eighth\"); //108\nwordsToNumbers(\"one hundred and tenth\"); //110\nwordsToNumbers(\"one hundred and ninety ninth\"); //199\n```\n\n## Implied Hundreds\n\n```javascript\nwordsToNumbers(\"nineteen eighty four\", { impliedHundreds: true }); //1984\nwordsToNumbers(\"one thirty\", { impliedHundreds: true }); //130\nwordsToNumbers(\"six sixty two\", { impliedHundreds: true }); //662\nwordsToNumbers(\"ten twelve\", { impliedHundreds: true }); //1012\nwordsToNumbers(\"nineteen ten\", { impliedHundreds: true }); //1910\nwordsToNumbers(\"twenty ten\", { impliedHundreds: true }); //2010\nwordsToNumbers(\"twenty seventeen\", { impliedHundreds: true }); //2017\nwordsToNumbers(\"twenty twenty\", { impliedHundreds: true }); //2020\nwordsToNumbers(\"twenty twenty one\", { impliedHundreds: true }); //2021\nwordsToNumbers(\"fifty sixty three\", { impliedHundreds: true }); //5063\nwordsToNumbers(\"fifty sixty\", { impliedHundreds: true }); //5060\nwordsToNumbers(\"fifty sixty three thousand\", { impliedHundreds: true }); //5063000\nwordsToNumbers(\"one hundred thousand\", { impliedHundreds: true }); //100000\n```\n","readmeFilename":"README.md"}