New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@epdoc/typeutil

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@epdoc/typeutil

Typescript-aware guard tests and other standalone utilities

latest
Source
npmnpm
Version
2.3.0
Version published
Maintainers
1
Created
Source

@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

Utility Functions

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

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

DictUtil

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

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

const objUtil:DictUtil = dictUtil(obj);
const abVal:DictUtil = objUtil.property('a.b');
console.log( `Object value=${abVal.value()} and isInteger=${abVal.isInteger()}`);

Build and Publish

npm run build
npm test

Publish to @epdoc

npm run publish

Keywords

util

FAQs

Package last updated on 21 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts