1.0.9 • Published 1 month ago

@epdoc/typeutil v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

@epdoc/typeutil

Includes:

  • TypeScript-capable type-checking, type-guard and casting utilities
    • e.g. isString(), isPosInteger(), asInteger()
    • A Util object to encapslate type checking and reach into an Object's properties
  • Type declarations
    • Integer, Dict
  • Other common utilities, for example
    • delayPromise is setTimeout as a Promise
    • camelToDash, underscoreCapitalize string conversion
    • deepCopy, deepEquals
    • pad a string

Usage

import { isBoolean } from '@epdoc/typeutil';

if (isBoolean(value)) {
  doTask();
}

Using the Util class.

import { util as test } from '@epdoc/typeutil';

let obj = { a: { b: 3 } };
test(obj)
  .property('a.b')
  .value(); // returns 3

u.path('a.c').setValue({}, 4); // results in { a: { c: 4 }}

test(obj)
  .property('a.b')
  .isInteger(); // returns true

Build and Publish

npm run clean
npm run build
npm run test

Publish to @epdoc

npm run publish
1.0.9

1 month ago

1.0.8

4 months ago

1.0.7

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.3

4 months ago

1.0.2

4 months ago

1.0.1

4 months ago

1.0.0

6 months ago