Sudoo-Symbol

Continuous Integration codecov npm version downloads

Symbol Magic

Install

yarn add @sudoo/symbol
# Or
npm install @sudoo/symbol --save

Example

Symbol should be used as return values (and more!) to express more information from functions.

import { SEmptyReturn, EmptyReturnSymbol } from "@sudoo/symbol";

export const yourFunction = (arg: any): SEmptyReturn | AwesomeObject | null => {

    if (arg === null) {
        return null;
    }

    if (arg.hasNoData) {
        return EmptyReturnSymbol;
    }

    return arg.awesomeObject;
};

Note

Do not use @sudoo/symbol as required dependencies unless the project is not a package. Due to duplicated copy of package would cause type reference issue.