@onivoro/isomorphic-common 0.2.4 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/jest.config.d.ts +14 -0
- package/{src/index.ts → dist/esm/src/index.js} +0 -2
- package/dist/esm/src/lib/constants/millis-per-day.constant.d.ts +1 -0
- package/dist/esm/src/lib/constants/millis-per-hour.constant.d.ts +1 -0
- package/dist/esm/src/lib/constants/millis-per-minute.constant.d.ts +1 -0
- package/dist/esm/src/lib/functions/add-offset.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/camel-case.function.d.ts +20 -0
- package/dist/esm/src/lib/functions/convert-object-to-literal.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/from-boolean-string.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/from-calendar-date.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/from-csv-string.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/get-tag.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/is-symbol.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/kebab-case.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/parse-bool.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/properties-to-array.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/sanitize-filename.function.d.ts +1 -0
- package/{src/lib/functions/snake-case.function.ts → dist/esm/src/lib/functions/snake-case.function.d.ts} +1 -11
- package/dist/esm/src/lib/functions/subtract-offset.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/subtract-offset.function.spec.d.ts +1 -0
- package/dist/esm/src/lib/functions/to-boolean-string.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/to-calendar-date.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/to-csv-string.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/to-decimal-base.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/to-dollars-and-cents.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/to-dollars-and-cents.function.spec.d.ts +1 -0
- package/dist/esm/src/lib/functions/to-string.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/to-unique-array.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/to-unique-array.function.spec.d.ts +1 -0
- package/dist/esm/src/lib/functions/to-words.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/to-words.function.spec.d.ts +1 -0
- package/dist/esm/src/lib/functions/try-parse-date.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/try-parse-date.function.spec.d.ts +1 -0
- package/dist/esm/src/lib/functions/unicode-words.const.d.ts +8 -0
- package/dist/esm/src/lib/functions/upper-first.function.d.ts +1 -0
- package/dist/esm/src/lib/functions/upper-first.function.spec.d.ts +1 -0
- package/dist/esm/src/lib/functions/words.function.d.ts +17 -0
- package/{src/lib/interfaces/axios-wrapped-nest-exception.interface.ts → dist/esm/src/lib/interfaces/axios-wrapped-nest-exception.interface.d.ts} +1 -1
- package/dist/esm/src/lib/interfaces/axios-wrapped-nest-exception.interface.js +1 -0
- package/{src/lib/interfaces/entity-provider.interface.ts → dist/esm/src/lib/interfaces/entity-provider.interface.d.ts} +1 -1
- package/dist/esm/src/lib/interfaces/entity-provider.interface.js +1 -0
- package/dist/esm/src/lib/interfaces/keys-of.type.d.ts +3 -0
- package/dist/esm/src/lib/interfaces/keys-of.type.js +1 -0
- package/dist/types/jest.config.d.ts +14 -0
- package/dist/types/src/index.d.ts +29 -0
- package/dist/types/src/lib/constants/millis-per-day.constant.d.ts +1 -0
- package/dist/types/src/lib/constants/millis-per-hour.constant.d.ts +1 -0
- package/dist/types/src/lib/constants/millis-per-minute.constant.d.ts +1 -0
- package/dist/types/src/lib/functions/add-offset.function.d.ts +1 -0
- package/dist/types/src/lib/functions/add-offset.function.spec.d.ts +1 -0
- package/dist/types/src/lib/functions/camel-case.function.d.ts +20 -0
- package/dist/types/src/lib/functions/convert-object-to-literal.function.d.ts +1 -0
- package/dist/types/src/lib/functions/convert-object-to-literal.function.spec.d.ts +1 -0
- package/dist/types/src/lib/functions/from-boolean-string.function.d.ts +1 -0
- package/dist/types/src/lib/functions/from-calendar-date.function.d.ts +1 -0
- package/dist/types/src/lib/functions/from-calendar-date.function.spec.d.ts +1 -0
- package/dist/types/src/lib/functions/from-csv-string.function.d.ts +1 -0
- package/dist/types/src/lib/functions/get-tag.function.d.ts +1 -0
- package/dist/types/src/lib/functions/is-symbol.function.d.ts +1 -0
- package/dist/types/src/lib/functions/kebab-case.function.d.ts +1 -0
- package/dist/types/src/lib/functions/parse-bool.function.d.ts +1 -0
- package/dist/types/src/lib/functions/properties-to-array.function.d.ts +1 -0
- package/dist/types/src/lib/functions/sanitize-filename.function.d.ts +1 -0
- package/dist/types/src/lib/functions/snake-case.function.d.ts +24 -0
- package/dist/types/src/lib/functions/subtract-offset.function.d.ts +1 -0
- package/dist/types/src/lib/functions/subtract-offset.function.spec.d.ts +1 -0
- package/dist/types/src/lib/functions/to-boolean-string.function.d.ts +1 -0
- package/dist/types/src/lib/functions/to-calendar-date.function.d.ts +1 -0
- package/dist/types/src/lib/functions/to-csv-string.function.d.ts +1 -0
- package/dist/types/src/lib/functions/to-decimal-base.function.d.ts +1 -0
- package/dist/types/src/lib/functions/to-dollars-and-cents.function.d.ts +1 -0
- package/dist/types/src/lib/functions/to-dollars-and-cents.function.spec.d.ts +1 -0
- package/dist/types/src/lib/functions/to-string.function.d.ts +1 -0
- package/dist/types/src/lib/functions/to-unique-array.function.d.ts +1 -0
- package/dist/types/src/lib/functions/to-unique-array.function.spec.d.ts +1 -0
- package/dist/types/src/lib/functions/to-words.function.d.ts +1 -0
- package/dist/types/src/lib/functions/to-words.function.spec.d.ts +1 -0
- package/dist/types/src/lib/functions/try-parse-date.function.d.ts +1 -0
- package/dist/types/src/lib/functions/try-parse-date.function.spec.d.ts +1 -0
- package/dist/types/src/lib/functions/unicode-words.const.d.ts +8 -0
- package/dist/types/src/lib/functions/upper-first.function.d.ts +1 -0
- package/dist/types/src/lib/functions/upper-first.function.spec.d.ts +1 -0
- package/dist/types/src/lib/functions/words.function.d.ts +17 -0
- package/dist/types/src/lib/interfaces/axios-wrapped-nest-exception.interface.d.ts +5 -0
- package/dist/types/src/lib/interfaces/entity-provider.interface.d.ts +9 -0
- package/dist/types/src/lib/interfaces/keys-of.type.d.ts +3 -0
- package/package.json +16 -10
- package/dist +0 -20
- package/jest.config.ts +0 -17
- package/src/lib/constants/millis-per-day.constant.ts +0 -3
- package/src/lib/constants/millis-per-hour.constant.ts +0 -3
- package/src/lib/constants/millis-per-minute.constant.ts +0 -1
- package/src/lib/functions/__snapshots__/add-offset.function.spec.ts.snap +0 -5
- package/src/lib/functions/__snapshots__/convert-object-to-literal.function.spec.ts.snap +0 -3
- package/src/lib/functions/__snapshots__/from-calendar-date.function.spec.ts.snap +0 -3
- package/src/lib/functions/__snapshots__/subtract-offset.function.spec.ts.snap +0 -5
- package/src/lib/functions/__snapshots__/to-dollars-and-cents.function.spec.ts.snap +0 -3
- package/src/lib/functions/__snapshots__/to-words.function.spec.ts.snap +0 -3
- package/src/lib/functions/__snapshots__/try-parse-date.function.spec.ts.snap +0 -5
- package/src/lib/functions/__snapshots__/upper-first.function.spec.ts.snap +0 -13
- package/src/lib/functions/add-offset.function.spec.ts +0 -12
- package/src/lib/functions/add-offset.function.ts +0 -14
- package/src/lib/functions/camel-case.function.ts +0 -30
- package/src/lib/functions/convert-object-to-literal.function.spec.ts +0 -16
- package/src/lib/functions/convert-object-to-literal.function.ts +0 -10
- package/src/lib/functions/from-boolean-string.function.ts +0 -3
- package/src/lib/functions/from-calendar-date.function.spec.ts +0 -11
- package/src/lib/functions/from-calendar-date.function.ts +0 -5
- package/src/lib/functions/from-csv-string.function.ts +0 -3
- package/src/lib/functions/get-tag.function.ts +0 -10
- package/src/lib/functions/is-symbol.function.ts +0 -11
- package/src/lib/functions/kebab-case.function.ts +0 -5
- package/src/lib/functions/parse-bool.function.ts +0 -3
- package/src/lib/functions/properties-to-array.function.ts +0 -21
- package/src/lib/functions/sanitize-filename.function.ts +0 -9
- package/src/lib/functions/subtract-offset.function.spec.ts +0 -12
- package/src/lib/functions/subtract-offset.function.ts +0 -14
- package/src/lib/functions/to-boolean-string.function.ts +0 -3
- package/src/lib/functions/to-calendar-date.function.ts +0 -11
- package/src/lib/functions/to-csv-string.function.ts +0 -3
- package/src/lib/functions/to-decimal-base.function.ts +0 -23
- package/src/lib/functions/to-dollars-and-cents.function.spec.ts +0 -7
- package/src/lib/functions/to-dollars-and-cents.function.ts +0 -15
- package/src/lib/functions/to-string.function.ts +0 -25
- package/src/lib/functions/to-unique-array.function.spec.ts +0 -45
- package/src/lib/functions/to-unique-array.function.ts +0 -3
- package/src/lib/functions/to-words.function.spec.ts +0 -7
- package/src/lib/functions/to-words.function.ts +0 -105
- package/src/lib/functions/try-parse-date.function.spec.ts +0 -12
- package/src/lib/functions/try-parse-date.function.ts +0 -17
- package/src/lib/functions/unicode-words.const.ts +0 -70
- package/src/lib/functions/upper-first.function.spec.ts +0 -16
- package/src/lib/functions/upper-first.function.ts +0 -10
- package/src/lib/functions/words.function.ts +0 -38
- package/src/lib/interfaces/keys-of.type.ts +0 -1
- package/tsconfig.json +0 -16
- /package/{esm → dist/cjs}/jest.config.d.ts +0 -0
- /package/{cjs → dist/cjs}/jest.config.js +0 -0
- /package/{esm → dist/cjs}/src/index.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/index.js +0 -0
- /package/{esm → dist/cjs}/src/lib/constants/millis-per-day.constant.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/constants/millis-per-day.constant.js +0 -0
- /package/{esm → dist/cjs}/src/lib/constants/millis-per-hour.constant.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/constants/millis-per-hour.constant.js +0 -0
- /package/{esm → dist/cjs}/src/lib/constants/millis-per-minute.constant.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/constants/millis-per-minute.constant.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/add-offset.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/add-offset.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/add-offset.function.spec.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/add-offset.function.spec.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/camel-case.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/camel-case.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/convert-object-to-literal.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/convert-object-to-literal.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/convert-object-to-literal.function.spec.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/convert-object-to-literal.function.spec.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/from-boolean-string.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/from-boolean-string.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/from-calendar-date.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/from-calendar-date.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/from-calendar-date.function.spec.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/from-calendar-date.function.spec.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/from-csv-string.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/from-csv-string.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/get-tag.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/get-tag.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/is-symbol.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/is-symbol.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/kebab-case.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/kebab-case.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/parse-bool.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/parse-bool.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/properties-to-array.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/properties-to-array.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/sanitize-filename.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/sanitize-filename.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/snake-case.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/snake-case.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/subtract-offset.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/subtract-offset.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/subtract-offset.function.spec.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/subtract-offset.function.spec.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/to-boolean-string.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/to-boolean-string.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/to-calendar-date.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/to-calendar-date.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/to-csv-string.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/to-csv-string.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/to-decimal-base.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/to-decimal-base.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/to-dollars-and-cents.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/to-dollars-and-cents.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/to-dollars-and-cents.function.spec.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/to-dollars-and-cents.function.spec.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/to-string.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/to-string.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/to-unique-array.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/to-unique-array.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/to-unique-array.function.spec.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/to-unique-array.function.spec.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/to-words.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/to-words.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/to-words.function.spec.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/to-words.function.spec.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/try-parse-date.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/try-parse-date.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/try-parse-date.function.spec.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/try-parse-date.function.spec.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/unicode-words.const.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/unicode-words.const.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/upper-first.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/upper-first.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/upper-first.function.spec.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/upper-first.function.spec.js +0 -0
- /package/{esm → dist/cjs}/src/lib/functions/words.function.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/functions/words.function.js +0 -0
- /package/{esm → dist/cjs}/src/lib/interfaces/axios-wrapped-nest-exception.interface.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/interfaces/axios-wrapped-nest-exception.interface.js +0 -0
- /package/{esm → dist/cjs}/src/lib/interfaces/entity-provider.interface.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/interfaces/entity-provider.interface.js +0 -0
- /package/{esm → dist/cjs}/src/lib/interfaces/keys-of.type.d.ts +0 -0
- /package/{cjs → dist/cjs}/src/lib/interfaces/keys-of.type.js +0 -0
- /package/{esm → dist/esm}/jest.config.js +0 -0
- /package/{esm → dist/esm}/package.json +0 -0
- /package/{esm/src/index.js → dist/esm/src/index.d.ts} +0 -0
- /package/{esm → dist/esm}/src/lib/constants/millis-per-day.constant.js +0 -0
- /package/{esm → dist/esm}/src/lib/constants/millis-per-hour.constant.js +0 -0
- /package/{esm → dist/esm}/src/lib/constants/millis-per-minute.constant.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/add-offset.function.js +0 -0
- /package/{esm/src/lib/interfaces/axios-wrapped-nest-exception.interface.js → dist/esm/src/lib/functions/add-offset.function.spec.d.ts} +0 -0
- /package/{esm → dist/esm}/src/lib/functions/add-offset.function.spec.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/camel-case.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/convert-object-to-literal.function.js +0 -0
- /package/{esm/src/lib/interfaces/entity-provider.interface.js → dist/esm/src/lib/functions/convert-object-to-literal.function.spec.d.ts} +0 -0
- /package/{esm → dist/esm}/src/lib/functions/convert-object-to-literal.function.spec.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/from-boolean-string.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/from-calendar-date.function.js +0 -0
- /package/{esm/src/lib/interfaces/keys-of.type.js → dist/esm/src/lib/functions/from-calendar-date.function.spec.d.ts} +0 -0
- /package/{esm → dist/esm}/src/lib/functions/from-calendar-date.function.spec.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/from-csv-string.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/get-tag.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/is-symbol.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/kebab-case.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/parse-bool.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/properties-to-array.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/sanitize-filename.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/snake-case.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/subtract-offset.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/subtract-offset.function.spec.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/to-boolean-string.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/to-calendar-date.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/to-csv-string.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/to-decimal-base.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/to-dollars-and-cents.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/to-dollars-and-cents.function.spec.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/to-string.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/to-unique-array.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/to-unique-array.function.spec.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/to-words.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/to-words.function.spec.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/try-parse-date.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/try-parse-date.function.spec.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/unicode-words.const.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/upper-first.function.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/upper-first.function.spec.js +0 -0
- /package/{esm → dist/esm}/src/lib/functions/words.function.js +0 -0
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`subtractOffset GIVEN input is partial or full ISO8601 "2023-12-23" 1`] = `2023-12-22T18:00:00.000Z`;
|
|
4
|
-
|
|
5
|
-
exports[`subtractOffset GIVEN input is partial or full ISO8601 "2023-12-23T00:00:00.000" 1`] = `2023-12-23T00:00:00.000Z`;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`tryParseDate GIVEN input is partial or full ISO8601 "2023-12-23" 1`] = `2023-12-23T00:00:00.000Z`;
|
|
4
|
-
|
|
5
|
-
exports[`tryParseDate GIVEN input is partial or full ISO8601 "2023-12-23T00:00:00.000" 1`] = `2023-12-23T06:00:00.000Z`;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`upperFirst GIVEN "XCVB", does what u expect 1`] = `"Xcvb"`;
|
|
4
|
-
|
|
5
|
-
exports[`upperFirst GIVEN "asdf", does what u expect 1`] = `"Asdf"`;
|
|
6
|
-
|
|
7
|
-
exports[`upperFirst GIVEN falsey input 0, does what u expect 1`] = `0`;
|
|
8
|
-
|
|
9
|
-
exports[`upperFirst GIVEN falsey input false, does what u expect 1`] = `false`;
|
|
10
|
-
|
|
11
|
-
exports[`upperFirst GIVEN falsey input null, does what u expect 1`] = `null`;
|
|
12
|
-
|
|
13
|
-
exports[`upperFirst GIVEN falsey input undefined, does what u expect 1`] = `undefined`;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { addOffset } from './add-offset.function';
|
|
2
|
-
|
|
3
|
-
describe('addOffset', () => {
|
|
4
|
-
describe('GIVEN input is partial or full ISO8601', () => {
|
|
5
|
-
it.each([
|
|
6
|
-
'2023-12-23',
|
|
7
|
-
'2023-12-23T00:00:00.000',
|
|
8
|
-
])('%j', (input) => {
|
|
9
|
-
expect(addOffset(input)).toMatchSnapshot();
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MILLIS_PER_MINUTE } from '../constants/millis-per-minute.constant';
|
|
2
|
-
import { tryParseDate } from './try-parse-date.function';
|
|
3
|
-
|
|
4
|
-
export function addOffset(input: string | Date | undefined | null): Date | undefined {
|
|
5
|
-
const parsed = tryParseDate(input);
|
|
6
|
-
|
|
7
|
-
if(!parsed) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const offset = (parsed).getTimezoneOffset();
|
|
12
|
-
|
|
13
|
-
return new Date(parsed.valueOf() + offset * MILLIS_PER_MINUTE);
|
|
14
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// https://github.com/lodash/lodash/blob/main/src/camelCase.ts
|
|
2
|
-
|
|
3
|
-
import { toString } from './to-string.function';
|
|
4
|
-
import { upperFirst } from './upper-first.function';
|
|
5
|
-
import { words } from './words.function';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
|
|
9
|
-
*
|
|
10
|
-
* @since 3.0.0
|
|
11
|
-
* @category String
|
|
12
|
-
* @param {string} [string=''] The string to convert.
|
|
13
|
-
* @returns {string} Returns the camel cased string.
|
|
14
|
-
* @see lowerCase, kebabCase, snakeCase, startCase, upperCase, upperFirst
|
|
15
|
-
* @example
|
|
16
|
-
*
|
|
17
|
-
* camelCase('Foo Bar')
|
|
18
|
-
* // => 'fooBar'
|
|
19
|
-
*
|
|
20
|
-
* camelCase('--foo-bar--')
|
|
21
|
-
* // => 'fooBar'
|
|
22
|
-
*
|
|
23
|
-
* camelCase('__FOO_BAR__')
|
|
24
|
-
* // => 'fooBar'
|
|
25
|
-
*/
|
|
26
|
-
export const camelCase = (string: string): string =>
|
|
27
|
-
words(toString(string).replace(/['\u2019]/g, '')).reduce((result: string, word: string, index: number) => {
|
|
28
|
-
word = word.toLowerCase();
|
|
29
|
-
return result + (index ? upperFirst(word) : word);
|
|
30
|
-
}, '');
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { convertObjectToLiteral } from './convert-object-to-literal.function';
|
|
2
|
-
|
|
3
|
-
const qty = 337;
|
|
4
|
-
const price = 100;
|
|
5
|
-
const product = 'flux-capacitor';
|
|
6
|
-
|
|
7
|
-
describe(__filename, () => {
|
|
8
|
-
it.each([[(k, v) => `${k}=${v}`, ' AND ', { qty, price, product }]])(
|
|
9
|
-
'converts an object to a string',
|
|
10
|
-
(literalFn, delimiter, obj) => {
|
|
11
|
-
expect(
|
|
12
|
-
convertObjectToLiteral(literalFn, delimiter, obj)
|
|
13
|
-
).toMatchSnapshot();
|
|
14
|
-
}
|
|
15
|
-
);
|
|
16
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export function convertObjectToLiteral(
|
|
2
|
-
literalFn: (k: string, v: any) => string,
|
|
3
|
-
delimiter: string,
|
|
4
|
-
keyValuePairs: Record<string, any>
|
|
5
|
-
) {
|
|
6
|
-
return Object.entries(keyValuePairs)
|
|
7
|
-
.filter(([, v]) => !!v || v === 0 || v === false)
|
|
8
|
-
.map(([k, v]) => literalFn(k, v?.toString?.()))
|
|
9
|
-
.join(delimiter);
|
|
10
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { fromCalendarDate } from './from-calendar-date.function';
|
|
2
|
-
|
|
3
|
-
describe('fromCalendarDate', () => {
|
|
4
|
-
describe('GIVEN input is partial or full ISO8601', () => {
|
|
5
|
-
it.each([
|
|
6
|
-
'2023-12-23',
|
|
7
|
-
])('%j', (input) => {
|
|
8
|
-
expect(fromCalendarDate(input)).toMatchSnapshot();
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// https://github.com/lodash/lodash/blob/main/src/.internal/getTag.ts
|
|
2
|
-
|
|
3
|
-
const toString = Object.prototype.toString
|
|
4
|
-
|
|
5
|
-
export function getTag(value: any): string {
|
|
6
|
-
if (value == null) {
|
|
7
|
-
return value === undefined ? '[object Undefined]' : '[object Null]'
|
|
8
|
-
}
|
|
9
|
-
return toString.call(value)
|
|
10
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// https://github.com/lodash/lodash/blob/main/src/isSymbol.ts
|
|
2
|
-
|
|
3
|
-
import { getTag } from './get-tag.function';
|
|
4
|
-
|
|
5
|
-
export function isSymbol(value: any): boolean {
|
|
6
|
-
const type = typeof value;
|
|
7
|
-
return (
|
|
8
|
-
type === 'symbol' ||
|
|
9
|
-
(type === 'object' && value != null && getTag(value) === '[object Symbol]')
|
|
10
|
-
);
|
|
11
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// credit https://stackoverflow.com/questions/15690706/recursively-looping-through-an-object-to-build-a-property-list/53620876#53620876
|
|
2
|
-
|
|
3
|
-
export function propertiesToArray(obj) {
|
|
4
|
-
const isObject = val =>
|
|
5
|
-
val && typeof val === 'object' && !Array.isArray(val);
|
|
6
|
-
|
|
7
|
-
const addDelimiter = (a, b) =>
|
|
8
|
-
a ? `${a}.${b}` : b;
|
|
9
|
-
|
|
10
|
-
const paths = (obj = {}, head = '') => {
|
|
11
|
-
return Object.entries(obj)
|
|
12
|
-
.reduce((product, [key, value]) => {
|
|
13
|
-
let fullPath = addDelimiter(head, key)
|
|
14
|
-
return isObject(value) ?
|
|
15
|
-
product.concat(paths(value, fullPath))
|
|
16
|
-
: product.concat(fullPath)
|
|
17
|
-
}, []);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return paths(obj);
|
|
21
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-control-regex */
|
|
2
|
-
|
|
3
|
-
const _ = '_';
|
|
4
|
-
const asciiReplacementRegX = /\/|\?|:|\\|{|\^|'|\}|%|`|]|>|\[|~|<|#|\||"|!|\*/g;
|
|
5
|
-
const unicodeReplacementRegX = /[^\u0000-\u007F]/g;
|
|
6
|
-
|
|
7
|
-
export function sanitizeFilename(filename: string) {
|
|
8
|
-
return filename.replace(unicodeReplacementRegX, _).replace(asciiReplacementRegX, _).replace(/_+/g, _).trim();
|
|
9
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { subtractOffset } from './subtract-offset.function';
|
|
2
|
-
|
|
3
|
-
describe('subtractOffset', () => {
|
|
4
|
-
describe('GIVEN input is partial or full ISO8601', () => {
|
|
5
|
-
it.each([
|
|
6
|
-
'2023-12-23',
|
|
7
|
-
'2023-12-23T00:00:00.000',
|
|
8
|
-
])('%j', (input) => {
|
|
9
|
-
expect(subtractOffset(input)).toMatchSnapshot();
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MILLIS_PER_MINUTE } from '../constants/millis-per-minute.constant';
|
|
2
|
-
import { tryParseDate } from './try-parse-date.function';
|
|
3
|
-
|
|
4
|
-
export function subtractOffset(input: string | Date | undefined | null): Date | undefined {
|
|
5
|
-
const parsed = tryParseDate(input);
|
|
6
|
-
|
|
7
|
-
if(!parsed) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const offset = (parsed).getTimezoneOffset();
|
|
12
|
-
|
|
13
|
-
return new Date(parsed.valueOf() - offset * MILLIS_PER_MINUTE);
|
|
14
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { subtractOffset } from "./subtract-offset.function";
|
|
2
|
-
|
|
3
|
-
export function toCalendarDate(input: string | Date | undefined | null): string | undefined {
|
|
4
|
-
const parsed = subtractOffset(input);
|
|
5
|
-
|
|
6
|
-
if (!parsed) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
return parsed?.toISOString().split('T')[0];
|
|
11
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export function toDecimalBase(n: string | number, base = 16) {
|
|
2
|
-
const digits = n.toString().split('');
|
|
3
|
-
|
|
4
|
-
let answer = 0;
|
|
5
|
-
|
|
6
|
-
digits.reverse().forEach(function (d, i) {
|
|
7
|
-
let actualNumber = Number(d);
|
|
8
|
-
|
|
9
|
-
if (!actualNumber && actualNumber !== 0) {
|
|
10
|
-
const codeAt = d.charCodeAt(0);
|
|
11
|
-
|
|
12
|
-
if (codeAt >= 97) {
|
|
13
|
-
actualNumber = codeAt - 87;
|
|
14
|
-
} else {
|
|
15
|
-
actualNumber = codeAt - 55;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
answer = answer + actualNumber * Math.pow(base, i);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return answer;
|
|
23
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { toWords } from "./to-words.function";
|
|
2
|
-
|
|
3
|
-
export function toDollarsAndCents(number: any): string {
|
|
4
|
-
const num = Number(number);
|
|
5
|
-
const decimal = (Math.round((num % 1) * 100)) / 100;
|
|
6
|
-
const int = num - decimal;
|
|
7
|
-
|
|
8
|
-
const dollars = `${toWords(int)} dollars`;
|
|
9
|
-
|
|
10
|
-
if (!decimal) {
|
|
11
|
-
return dollars;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return `${dollars} and ${toWords(decimal * 100)} cents`;
|
|
15
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// https://github.com/lodash/lodash/blob/main/src/toString.ts
|
|
2
|
-
|
|
3
|
-
import { isSymbol } from './is-symbol.function';
|
|
4
|
-
|
|
5
|
-
/** Used as references for various `Number` constants. */
|
|
6
|
-
const INFINITY = 1 / 0;
|
|
7
|
-
|
|
8
|
-
export function toString(value: any): string {
|
|
9
|
-
if (value == null) {
|
|
10
|
-
return '';
|
|
11
|
-
}
|
|
12
|
-
// Exit early for strings to avoid a performance hit in some environments.
|
|
13
|
-
if (typeof value === 'string') {
|
|
14
|
-
return value;
|
|
15
|
-
}
|
|
16
|
-
if (Array.isArray(value)) {
|
|
17
|
-
// Recursively convert values (susceptible to call stack limits).
|
|
18
|
-
return `${value.map((other) => (other == null ? other : toString(other)))}`;
|
|
19
|
-
}
|
|
20
|
-
if (isSymbol(value)) {
|
|
21
|
-
return value.toString();
|
|
22
|
-
}
|
|
23
|
-
const result = `${value}`;
|
|
24
|
-
return result === '0' && 1 / value === -INFINITY ? '-0' : result;
|
|
25
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { toUniqueArray } from './to-unique-array.function';
|
|
2
|
-
|
|
3
|
-
describe('toUniqueArray', () => {
|
|
4
|
-
it.each([
|
|
5
|
-
[
|
|
6
|
-
[1, 2, 3],
|
|
7
|
-
[1, 2, 3],
|
|
8
|
-
],
|
|
9
|
-
[[1, 1, 1], [1]],
|
|
10
|
-
])(
|
|
11
|
-
'GIVEN array of numbers: %j, returns a unique array without duplicate elements',
|
|
12
|
-
(array, expected) => {
|
|
13
|
-
expect(toUniqueArray(array)).toEqual(expected);
|
|
14
|
-
}
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
it.each([
|
|
18
|
-
[
|
|
19
|
-
['one', 'two', 'three'],
|
|
20
|
-
['one', 'two', 'three'],
|
|
21
|
-
],
|
|
22
|
-
[['one', 'one', 'one'], ['one']],
|
|
23
|
-
])(
|
|
24
|
-
'GIVEN array of strings: %j, returns a unique array without duplicate elements',
|
|
25
|
-
(array, expected) => {
|
|
26
|
-
expect(toUniqueArray(array)).toEqual(expected);
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
it.each([
|
|
31
|
-
[
|
|
32
|
-
['one', 'two', 'three', undefined, undefined],
|
|
33
|
-
['one', 'two', 'three', undefined],
|
|
34
|
-
],
|
|
35
|
-
[
|
|
36
|
-
['one', 'one', 'one', null, null],
|
|
37
|
-
['one', null],
|
|
38
|
-
],
|
|
39
|
-
])(
|
|
40
|
-
'GIVEN array with falsey values: %j, returns a unique array without duplicate elements including falsey values',
|
|
41
|
-
(array, expected) => {
|
|
42
|
-
expect(toUniqueArray(array)).toEqual(expected);
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
});
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
const MAX_SAFE_INTEGER = 9007199254740991;
|
|
2
|
-
|
|
3
|
-
const TEN = 10;
|
|
4
|
-
const ONE_HUNDRED = 100;
|
|
5
|
-
const ONE_THOUSAND = 1000;
|
|
6
|
-
const ONE_MILLION = 1000000;
|
|
7
|
-
const ONE_BILLION = 1000000000;
|
|
8
|
-
const ONE_TRILLION = 1000000000000;
|
|
9
|
-
const ONE_QUADRILLION = 1000000000000000;
|
|
10
|
-
const MAX = MAX_SAFE_INTEGER + 1;
|
|
11
|
-
const LESS_THAN_TWENTY = [
|
|
12
|
-
'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten',
|
|
13
|
-
'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'
|
|
14
|
-
];
|
|
15
|
-
const TENTHS_LESS_THAN_HUNDRED = [
|
|
16
|
-
'zero', 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
export function toWords(number: any): string {
|
|
20
|
-
let words;
|
|
21
|
-
const num = parseInt(number, 10);
|
|
22
|
-
|
|
23
|
-
if (!isFinite(num)) {
|
|
24
|
-
throw new TypeError(
|
|
25
|
-
'Not a finite number: ' + number + ' (' + typeof number + ')'
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (!isSafeNumber(num)) {
|
|
30
|
-
throw new RangeError(
|
|
31
|
-
'Input is not a safe number, it\'s either too large or too small.'
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
words = generateWords(num);
|
|
36
|
-
|
|
37
|
-
return words;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function generateWords(number: any, words?: any[]): string {
|
|
41
|
-
let remainder, word;
|
|
42
|
-
|
|
43
|
-
if (number === 0) {
|
|
44
|
-
return !words ? 'zero' : words.join(' ').replace(/,$/, '');
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (!words) {
|
|
48
|
-
words = [];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (number < 0) {
|
|
52
|
-
words.push('minus');
|
|
53
|
-
number = Math.abs(number);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (number < 20) {
|
|
57
|
-
remainder = 0;
|
|
58
|
-
word = LESS_THAN_TWENTY[number];
|
|
59
|
-
|
|
60
|
-
} else if (number < ONE_HUNDRED) {
|
|
61
|
-
remainder = number % TEN;
|
|
62
|
-
word = TENTHS_LESS_THAN_HUNDRED[Math.floor(number / TEN)];
|
|
63
|
-
|
|
64
|
-
if (remainder) {
|
|
65
|
-
word += '-' + LESS_THAN_TWENTY[remainder];
|
|
66
|
-
remainder = 0;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
} else if (number < ONE_THOUSAND) {
|
|
70
|
-
remainder = number % ONE_HUNDRED;
|
|
71
|
-
word = generateWords(Math.floor(number / ONE_HUNDRED)) + ' hundred';
|
|
72
|
-
|
|
73
|
-
} else if (number < ONE_MILLION) {
|
|
74
|
-
remainder = number % ONE_THOUSAND;
|
|
75
|
-
word = generateWords(Math.floor(number / ONE_THOUSAND)) + ' thousand,';
|
|
76
|
-
|
|
77
|
-
} else if (number < ONE_BILLION) {
|
|
78
|
-
remainder = number % ONE_MILLION;
|
|
79
|
-
word = generateWords(Math.floor(number / ONE_MILLION)) + ' million,';
|
|
80
|
-
|
|
81
|
-
} else if (number < ONE_TRILLION) {
|
|
82
|
-
remainder = number % ONE_BILLION;
|
|
83
|
-
word = generateWords(Math.floor(number / ONE_BILLION)) + ' billion,';
|
|
84
|
-
|
|
85
|
-
} else if (number < ONE_QUADRILLION) {
|
|
86
|
-
remainder = number % ONE_TRILLION;
|
|
87
|
-
word = generateWords(Math.floor(number / ONE_TRILLION)) + ' trillion,';
|
|
88
|
-
|
|
89
|
-
} else if (number <= MAX) {
|
|
90
|
-
remainder = number % ONE_QUADRILLION;
|
|
91
|
-
word = generateWords(Math.floor(number / ONE_QUADRILLION)) +
|
|
92
|
-
' quadrillion,';
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
words.push(word);
|
|
96
|
-
return generateWords(remainder, words);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function isFinite(value: any) {
|
|
100
|
-
return !(typeof value !== 'number' || value !== value || value === Infinity || value === -Infinity);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function isSafeNumber(value: any) {
|
|
104
|
-
return typeof value === 'number' && Math.abs(value) <= MAX_SAFE_INTEGER;
|
|
105
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { tryParseDate } from './try-parse-date.function';
|
|
2
|
-
|
|
3
|
-
describe('tryParseDate', () => {
|
|
4
|
-
describe('GIVEN input is partial or full ISO8601', () => {
|
|
5
|
-
it.each([
|
|
6
|
-
'2023-12-23',
|
|
7
|
-
'2023-12-23T00:00:00.000',
|
|
8
|
-
])('%j', (input) => {
|
|
9
|
-
expect(tryParseDate(input)).toMatchSnapshot();
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export function tryParseDate(input: string | Date | undefined | null): Date | undefined {
|
|
2
|
-
if (!input) {
|
|
3
|
-
return;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
if(input instanceof Date) {
|
|
7
|
-
return input;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const date = new Date(input);
|
|
11
|
-
|
|
12
|
-
if ((date as any) == 'Invalid Date') {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return date;
|
|
17
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// source https://github.com/lodash/lodash/blob/master/.internal/unicodeWords.js
|
|
2
|
-
|
|
3
|
-
/** Used to compose unicode character classes. */
|
|
4
|
-
const rsAstralRange = '\\ud800-\\udfff'
|
|
5
|
-
const rsComboMarksRange = '\\u0300-\\u036f'
|
|
6
|
-
const reComboHalfMarksRange = '\\ufe20-\\ufe2f'
|
|
7
|
-
const rsComboSymbolsRange = '\\u20d0-\\u20ff'
|
|
8
|
-
const rsComboMarksExtendedRange = '\\u1ab0-\\u1aff'
|
|
9
|
-
const rsComboMarksSupplementRange = '\\u1dc0-\\u1dff'
|
|
10
|
-
const rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange + rsComboMarksExtendedRange + rsComboMarksSupplementRange
|
|
11
|
-
const rsDingbatRange = '\\u2700-\\u27bf'
|
|
12
|
-
const rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff'
|
|
13
|
-
const rsMathOpRange = '\\xac\\xb1\\xd7\\xf7'
|
|
14
|
-
const rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf'
|
|
15
|
-
const rsPunctuationRange = '\\u2000-\\u206f'
|
|
16
|
-
const rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000'
|
|
17
|
-
const rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde'
|
|
18
|
-
const rsVarRange = '\\ufe0e\\ufe0f'
|
|
19
|
-
const rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange
|
|
20
|
-
|
|
21
|
-
/** Used to compose unicode capture groups. */
|
|
22
|
-
const rsApos = "['\u2019]"
|
|
23
|
-
const rsBreak = `[${rsBreakRange}]`
|
|
24
|
-
const rsCombo = `[${rsComboRange}]`
|
|
25
|
-
const rsDigit = '\\d'
|
|
26
|
-
const rsDingbat = `[${rsDingbatRange}]`
|
|
27
|
-
const rsLower = `[${rsLowerRange}]`
|
|
28
|
-
const rsMisc = `[^${rsAstralRange}${rsBreakRange + rsDigit + rsDingbatRange + rsLowerRange + rsUpperRange}]`
|
|
29
|
-
const rsFitz = '\\ud83c[\\udffb-\\udfff]'
|
|
30
|
-
const rsModifier = `(?:${rsCombo}|${rsFitz})`
|
|
31
|
-
const rsNonAstral = `[^${rsAstralRange}]`
|
|
32
|
-
const rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}'
|
|
33
|
-
const rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]'
|
|
34
|
-
const rsUpper = `[${rsUpperRange}]`
|
|
35
|
-
const rsZWJ = '\\u200d'
|
|
36
|
-
|
|
37
|
-
/** Used to compose unicode regexes. */
|
|
38
|
-
const rsMiscLower = `(?:${rsLower}|${rsMisc})`
|
|
39
|
-
const rsMiscUpper = `(?:${rsUpper}|${rsMisc})`
|
|
40
|
-
const rsOptContrLower = `(?:${rsApos}(?:d|ll|m|re|s|t|ve))?`
|
|
41
|
-
const rsOptContrUpper = `(?:${rsApos}(?:D|LL|M|RE|S|T|VE))?`
|
|
42
|
-
const reOptMod = `${rsModifier}?`
|
|
43
|
-
const rsOptVar = `[${rsVarRange}]?`
|
|
44
|
-
const rsOptJoin = `(?:${rsZWJ}(?:${[rsNonAstral, rsRegional, rsSurrPair].join('|')})${rsOptVar + reOptMod})*`
|
|
45
|
-
const rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])'
|
|
46
|
-
const rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])'
|
|
47
|
-
const rsSeq = rsOptVar + reOptMod + rsOptJoin
|
|
48
|
-
const rsEmoji = `(?:${[rsDingbat, rsRegional, rsSurrPair].join('|')})${rsSeq}`
|
|
49
|
-
|
|
50
|
-
const reUnicodeWords = RegExp([
|
|
51
|
-
`${rsUpper}?${rsLower}+${rsOptContrLower}(?=${[rsBreak, rsUpper, '$'].join('|')})`,
|
|
52
|
-
`${rsMiscUpper}+${rsOptContrUpper}(?=${[rsBreak, rsUpper + rsMiscLower, '$'].join('|')})`,
|
|
53
|
-
`${rsUpper}?${rsMiscLower}+${rsOptContrLower}`,
|
|
54
|
-
`${rsUpper}+${rsOptContrUpper}`,
|
|
55
|
-
rsOrdUpper,
|
|
56
|
-
rsOrdLower,
|
|
57
|
-
`${rsDigit}+`,
|
|
58
|
-
rsEmoji
|
|
59
|
-
].join('|'), 'g')
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Splits a Unicode `string` into an array of its words.
|
|
63
|
-
*
|
|
64
|
-
* @private
|
|
65
|
-
* @param {string} The string to inspect.
|
|
66
|
-
* @returns {Array} Returns the words of `string`.
|
|
67
|
-
*/
|
|
68
|
-
export function unicodeWords(string) {
|
|
69
|
-
return string.match(reUnicodeWords)
|
|
70
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { upperFirst } from './upper-first.function';
|
|
2
|
-
|
|
3
|
-
describe('upperFirst', () => {
|
|
4
|
-
it.each([
|
|
5
|
-
'asdf',
|
|
6
|
-
'XCVB'
|
|
7
|
-
])('GIVEN %j, does what u expect', (input) => {
|
|
8
|
-
expect(upperFirst(input)).toMatchSnapshot();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it.each([
|
|
12
|
-
null, undefined, 0, false
|
|
13
|
-
])('GIVEN falsey input %j, does what u expect', (input) => {
|
|
14
|
-
expect(upperFirst(input)).toMatchSnapshot();
|
|
15
|
-
});
|
|
16
|
-
});
|