@petsel/es-type-detection - v1.0.0
    Preparing search index...

    @petsel/es-type-detection - v1.0.0

    ES Type Detection

    A modern utility library for ECMAScript type detection โ€” built to be safe, testable, and extensible โ€” zero dependencies, fully inspectable.

    codecov CI

    • ๐Ÿ“ฆ Zero dependencies, suitable for any JavaScript runtime.
    • ๐Ÿ”ข Detection of basic built-in types and primitive vs boxed types detection.
    • ๐Ÿง  Distinguishes function-types accurately โ€” class vs. function vs. generator vs. async and much more.
    • ๐Ÿ”ฅ Fine grained error-type detection.
    • ๐ŸŒŠ Accurate "flow-type" detection โ€” generators, thenables, promises.
    • ๐Ÿงฉ Extensible, and comes with both type-identity detection and stable type-identity tagging/branding.
    • ๐Ÿงช Fully tested with coverage reporting.
    • ๐Ÿ“˜ Richly documented via TypeDoc.
    npm install @petsel/es-type-detection
    
    import { base, fn, flow, utility } from '@petsel/es-type-detection';

    const { isFunction, isObject, isBoxedNumber, isNumberValue, isNumber } = base;
    const { isConstructable, isClass, isGeneratorFunction, isNonAsyncArrow } = fn;
    const { isAsyncGenerator, isPromise, doesMatchSafeThenable } = flow;
    const { resolveType } = utility;

    console.log(isClass(class X {})); // true
    console.log(isFunction((_) => _)); // true
    console.log(resolveType([])); // "Array"

    This project is licensed under the MIT License.

    MIT ยฉ Peter Seliger

    See LICENSE for details.

    Please read the TRADEMARK.md for rules regarding project name use, compatibility requirements, and monetization restrictions.

    • clone (or download)
      git clone git@github.com:petsel/es-type-detection.git
      
    • install
      npm ci