GithubHelp home page GithubHelp logo

shmuelie / humanizer.js Goto Github PK

View Code? Open in Web Editor NEW
72.0 7.0 13.0 402 KB

Humanizer meets all your JavaScript needs for manipulating and displaying strings, dates, times, numbers and quantities

License: MIT License

TypeScript 100.00%
humanizer typescript javascript timespan quantities

humanizer.js's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

humanizer.js's Issues

npm module

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.

Clean up the project folders

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.

Status query

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:

  1. Is this maintained? I note it has been quite some time since this was last updated.
  2. What's the full status at this point? The README indicates it doesn't match everything in the main Humanizer implementation—is that still the case?
  3. Do you need help and/or are you interested in contributions? (It would be a bit before I'm able to contribute anything, but again: just a status query.)

Thanks!

Leverage TypeScript for project coding and compilation

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

pluralizing irregular words does not work correctly

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!

fix typescript errors

λ 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.