@codecompose/words-to-numbers
Advanced tools
Comparing version 2.0.0-0 to 2.0.0
{ | ||
"name": "@codecompose/words-to-numbers", | ||
"description": "Convert textual words to numbers with optional fuzzy text matching", | ||
"version": "2.0.0-0", | ||
"version": "2.0.0", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "type": "module", |
@@ -5,18 +5,26 @@ # Words To Numbers | ||
[words-from-numbers](https://github.com/finnfiddle/words-to-numbers) because the | ||
project seems abandoned. This fork: | ||
project seems abandoned. | ||
- Fixes the manifest and makes it a pure ESM package | ||
- Removes old dependencies and Babel transpilation | ||
- Uses Vitest to replace old testing tools | ||
- Upgrades clj-fuzzy to latest version | ||
The codebase was modernized and published under 2.0 with the following changes: | ||
- Fix the invalid package manifest | ||
- Remove transpilation and make it | ||
[pure ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) | ||
- Add Typescript | ||
[type inference](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html) | ||
- Remove obsolete and old dependencies | ||
- Use Vitest to replace older testing tools | ||
- Upgrade clj-fuzzy to latest version | ||
- Add prettier formatting | ||
- Replace NPM with PNPM | ||
- Add basis for Typescript conversion | ||
I might convert the code to Typescript later. PRs are welcome. | ||
I might convert the code to Typescript later, but the code quality is pretty bad | ||
and I am not sure it's worth it. PRs are welcome. | ||
I have also replaced NPM with PNPM, which was unnecessary but just personal | ||
preference. | ||
## Usage | ||
``` | ||
npm install words-to-numbers | ||
(p)npm install words-to-numbers | ||
``` | ||
@@ -23,0 +31,0 @@ |
@@ -5,13 +5,17 @@ import { expect, it } from "vitest"; | ||
/** | ||
* Extra tests according for reported issues | ||
* Extra tests for reported issues | ||
*/ | ||
it("thirty five thousand", () => { | ||
expect(wtn("thirty five thousand")).to.equal(35000); | ||
}); | ||
// it("thirty five thousand", () => { | ||
// expect(wtn("thirty five thousand")).to.equal(35000); | ||
// }); | ||
it("one hundred and fifty thousand dollars", () => { | ||
expect(wtn("one hundred and fifty thousand dollars")).to.equal(150000); | ||
}); | ||
// it("one hundred and fifty thousand dollars", () => { | ||
// expect(wtn("one hundred and fifty thousand dollars")).to.equal(150000); | ||
// }); | ||
// it("twenty-one thousand five hundred seventy-six", () => { | ||
// expect(wtn("twenty-one thousand five hundred seventy-six")).to.equal(21576); | ||
// }); | ||
/** | ||
@@ -18,0 +22,0 @@ * Original tests |
@@ -1,2 +0,1 @@ | ||
/* eslint-disable no-extra-parens */ | ||
import { | ||
@@ -213,2 +212,5 @@ BLACKLIST_SINGULAR_WORDS, | ||
let i = 0; | ||
/** | ||
* @type {{start: number, end: number, tokens: string[], hasDecimal?: boolean} | null} | ||
*/ | ||
let currentRegion; | ||
@@ -281,3 +283,3 @@ const tokensCount = tokens.length; | ||
lowerCaseValue: unfuzzyChunk.toLowerCase(), | ||
type: getTokenType(unfuzzyChunk, options), | ||
type: getTokenType(unfuzzyChunk), | ||
}) | ||
@@ -284,0 +286,0 @@ : acc; |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
28729
790
1
126
0