shmuelie / humanizer.js Goto Github PK
View Code? Open in Web Editor NEWHumanizer meets all your JavaScript needs for manipulating and displaying strings, dates, times, numbers and quantities
License: MIT License
Humanizer meets all your JavaScript needs for manipulating and displaying strings, dates, times, numbers and quantities
License: MIT License
there are lots of generated *.js
and *.js.map
files in the source code that should be removed using the .gitignore
file.
Hello @SamuelEnglard,
Does this project have an npm module published to the registry? If not, are there any plans to make it so? I'd like to use this project in a Typescript app I'm working on and it isn't a very nice approach (IMHO) to just add a dependency to the repo.
Regards.
Using a Visual Studio project is probably way overkill for the project. It will be fine as an editor, but if the project system isn't going to compile the JS, then the solution files and folder structure probably aren't necessary.
I'm evaluating some of the options in this space for improving some of our accessibility stuff, so I'm checking in on the status:
Thanks!
Humanizer is a complicated project, with a lot of code. Putting everything in one giant JS file is probably not going to be maintainable by anyone in the community.
TypeScript is uniquely suited to handle such a large project. I propose that the project be set up to exactly mirror the Humanizer PCL project, with the exact same directory structure and file names. If each file has a 1:1 mapping with Humanizer.C#, then it will be much easier to maintain as Humanizer.C# moves forward.
The TypeScript compiler can use require() and Modules to combine all of the code into one JS file, saving time, and more importantly, allowing the compile process to leverage grunt and Travis CI on GitHub to provide assurances that pull requests can be compiled.
More details can be found here: http://www.typescriptlang.org/Handbook#modules. For insight on getting Travis CI working with GitHub, check out DefinitelyTyped. https://github.com/borisyankov/DefinitelyTyped
Hello,
When pluralizing words with irregular pluralizations (ie. not just adding an s) the result is not formatted correctly.
examples
company'.pluralize() // outputs compa\1ies
mouse'.pluralize() // outputs \1ice
Thanks!
λ tsc
Bytes/ByteSize.ts(271,17): error TS2322: Type 'null' is not assignable to type 'ByteSize'.
Bytes/ByteSize.ts(286,17): error TS2322: Type 'null' is not assignable to type 'ByteSize'.
Bytes/ByteSize.ts(296,29): error TS2322: Type 'null' is not assignable to type 'ByteSize'.
Bytes/ByteSize.ts(310,13): error TS2322: Type 'null' is not assignable to type 'ByteSize'.
Bytes/byteSizeExtensions.ts(24,40): error TS2345: Argument of type 'Number' is not assignable to parameter of type
'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
Bytes/byteSizeExtensions.ts(36,41): error TS2345: Argument of type 'Number' is not assignable to parameter of type
'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
Bytes/byteSizeExtensions.ts(48,45): error TS2345: Argument of type 'Number' is not assignable to parameter of type
'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
Bytes/byteSizeExtensions.ts(60,45): error TS2345: Argument of type 'Number' is not assignable to parameter of type
'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
Bytes/byteSizeExtensions.ts(72,45): error TS2345: Argument of type 'Number' is not assignable to parameter of type
'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
Bytes/byteSizeExtensions.ts(84,44): error TS2345: Argument of type 'Number' is not assignable to parameter of type
'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
FluentDate/prepositionsExtensions.ts(27,16): error TS2554: Expected 4 arguments, but got 1.
FluentDate/prepositionsExtensions.ts(39,16): error TS2554: Expected 4 arguments, but got 1.
Localisation/CollectionFormatters/DefaultCollectionFormatter.ts(13,24): error TS2366: Function lacks ending return
statement and return type does not include 'undefined'.
Localisation/NumberToWords/SpanishNumberToWordsConverter.ts(83,9): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
Resources/resource.ts(56,48): error TS2339: Property 'userLanguage' does not exist on type 'Navigator'.
Transformer/To.ts(22,13): error TS2322: Type 'String' is not assignable to type 'string'.
'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
Truncation/FixedLengthTruncator.ts(11,17): error TS2322: Type 'null' is not assignable to type 'string'.
Truncation/FixedNumberOfCharactersTruncator.ts(12,17): error TS2322: Type 'null' is not assignable to type 'string'.
Truncation/FixedNumberOfCharactersTruncator.ts(27,17): error TS2531: Object is possibly 'null'.
Truncation/FixedNumebrOfWordsTruncator.ts(71,17): error TS2322: Type 'null' is not assignable to type 'string'.
inflectorExtensions.ts(54,17): error TS2322: Type 'null' is not assignable to type 'string'.
inflectorExtensions.ts(155,13): error TS2322: Type 'null' is not assignable to type 'string'.
inflectorExtensions.ts(181,33): error TS2352: Type 'this' cannot be converted to type 'string'.
Type 'Inflector' is not comparable to type 'string'.
inflectorExtensions.ts(208,33): error TS2352: Type 'this' cannot be converted to type 'string'.
numberToTimeSpanExtension.ts(29,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
numberToTimeSpanExtension.ts(34,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
numberToTimeSpanExtension.ts(39,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
numberToTimeSpanExtension.ts(44,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
numberToTimeSpanExtension.ts(49,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
numberToTimeSpanExtension.ts(54,9): error TS2322: Type 'Number' is not assignable to type 'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
numberToTimeSpanExtension.ts(59,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
numberToTimeSpanExtension.ts(64,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
numberToTimeSpanExtension.ts(69,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
numberToTimeSpanExtension.ts(74,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
numberToTimeSpanExtension.ts(79,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
numberToTimeSpanExtension.ts(84,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
numberToTimeSpanExtension.ts(89,9): error TS2322: Type 'Number' is not assignable to type 'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
numberToTimeSpanExtension.ts(94,41): error TS2345: Argument of type 'Number' is not assignable to parameter of type 'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
numberToTimeSpanExtension.ts(165,13): error TS2454: Variable 'result' is used before being assigned.
numberToTimeSpanExtension.ts(169,13): error TS2454: Variable 'result' is used before being assigned.
numberToTimeSpanExtension.ts(173,13): error TS2454: Variable 'result' is used before being assigned.
numberToTimeSpanExtension.ts(177,13): error TS2454: Variable 'result' is used before being assigned.
numberToTimeSpanExtension.ts(181,13): error TS2454: Variable 'result' is used before being assigned.
numberToTimeSpanExtension.ts(185,13): error TS2454: Variable 'result' is used before being assigned.
numberToTimeSpanExtension.ts(189,13): error TS2454: Variable 'result' is used before being assigned.
numberToTimeSpanExtension.ts(191,16): error TS2454: Variable 'result' is used before being assigned.
numberToTimeSpanExtension.ts(196,9): error TS2322: Type 'string | null' is not assignable to type 'string'.
Type 'null' is not assignable to type 'string'.
numberToWordsExtension.ts(26,38): error TS2345: Argument of type 'Number' is not assignable to parameter of type 'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
numberToWordsExtension.ts(28,34): error TS2345: Argument of type 'Number' is not assignable to parameter of type 'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
numberToWordsExtension.ts(37,47): error TS2345: Argument of type 'Number' is not assignable to parameter of type 'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
numberToWordsExtension.ts(39,43): error TS2345: Argument of type 'Number' is not assignable to parameter of type 'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
ordinalizeExtensions.ts(35,81): error TS2345: Argument of type 'String' is not assignable to parameter of type 'string'.
'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
ordinalizeExtensions.ts(35,92): error TS2345: Argument of type 'String' is not assignable to parameter of type 'string'.
'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
ordinalizeExtensions.ts(39,81): error TS2345: Argument of type 'String' is not assignable to parameter of type 'string'.
'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
ordinalizeExtensions.ts(39,92): error TS2345: Argument of type 'String' is not assignable to parameter of type 'string'.
'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
ordinalizeExtensions.ts(62,72): error TS2345: Argument of type 'Number' is not assignable to parameter of type 'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
ordinalizeExtensions.ts(66,72): error TS2345: Argument of type 'Number' is not assignable to parameter of type 'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
ordinalizeExtensions.ts(66,83): error TS2551: Property 'String' does not exist on type 'Number'. Did you mean 'toString'?
romanNumeralExtensions.ts(103,13): error TS2322: Type 'Number' is not assignable to type 'number'.
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
stringHumanizerExtensions.ts(68,29): error TS2345: Argument of type 'String' is not assignable to parameter of type 'string'.
'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
stringHumanizerExtensions.ts(72,29): error TS2345: Argument of type 'String' is not assignable to parameter of type 'string'.
'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
toQuantityExtensions.ts(28,18): error TS2678: Type 'ShowQuantityAs.None' is not comparable to type 'ShowQuantityAs.Numeric | ShowQuantityAs.Words'.
truncateExtensions.ts(59,35): error TS2345: Argument of type 'String' is not assignable to parameter of type 'string'.
'string' is a primitive, but 'String' is a wrapper object. Prefer using 'string' when possible.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.