Neatly Packaged Manuals

    @sounisi5011/ts-utils-is-property-accessible
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.3 • Public • Published

    @sounisi5011/ts-utils-is-property-accessible

    Go to the latest release page on npm Tested with Jest Commitizen friendly Minified Bundle Size Details Install Size Details Dependencies Status Build Status Maintainability Status

    Check if a value is property accessible.

    Installation

    npm install @sounisi5011/ts-utils-is-property-accessible
    yarn add @sounisi5011/ts-utils-is-property-accessible
    pnpm add @sounisi5011/ts-utils-is-property-accessible

    Usage

    TypeScript

    import { isPropertyAccessible } from '@sounisi5011/ts-utils-is-property-accessible';
    
    if (isPropertyAccessible(value)) {
        // `value.anyProperty` is available!
        // Because the value is neither null nor undefined.
        // In addition, an index signature type will be added so that any property can be read.
    } else {
        // If you try to read or write any property, a TypeError will probably be thrown.
        // Because the value is null or undefined.
    }

    JavaScript (ES Modules)

    import { isPropertyAccessible } from '@sounisi5011/ts-utils-is-property-accessible';
    
    if (isPropertyAccessible(value)) {
        // `value.anyProperty` is available!
        // Because the value is neither null nor undefined.
    } else {
        // If you try to read or write any property, a TypeError will probably be thrown.
        // Because the value is null or undefined.
    }

    JavaScript (CommonJS)

    const { isPropertyAccessible } = require('@sounisi5011/ts-utils-is-property-accessible');
    
    if (isPropertyAccessible(value)) {
        // `value.anyProperty` is available!
        // Because the value is neither null nor undefined.
    } else {
        // If you try to read or write any property, a TypeError will probably be thrown.
        // Because the value is null or undefined.
    }

    Install

    npm i @sounisi5011/ts-utils-is-property-accessible

    DownloadsWeekly Downloads

    12

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    12.5 kB

    Total Files

    8

    Last publish

    Collaborators

    • sounisi5011