TS Utils is a versatile collection of TypeScript utility functions designed to simplify your development tasks.
It provides a range of helpful functions for various common scenarios.
To incorporate TS Utils into your TypeScript projects, you can use either npm
or `yarn`` package manager.
Choose the one you're most comfortable with:
npm install @didiermargarido/ts-utils
yarn add @didiermargarido/ts-utils
TS Utils provides a comprehensive set of utility functions that can streamline various aspects of your TypeScript projects.
Here's a detailed guide on how to use some of the key utility functions available in TS Utils:
Method to check if value is defined.
// Util
import { isDefined } from "@didiermargarido/ts-utils";
// Output: true
isDefined("DM");
isDefined(10);
isDefined([]);
// Output: false
isDefined(null);
isDefined(undefined);
Method to check if value is empty.
// Util
import { isEmpty } from "@didiermargarido/ts-utils";
// Output: true
isEmpty("");
isEmpty([]);
isEmpty({});
isEmpty(null);
isEmpty(undefined);
// Output: false
isEmpty("DM");
isEmpty(["DM", 36]);
isEmpty({ key: "Demo" });
Didier Margarido
github/didiermargarido
TS Utils is open-sourced software licensed under the MIT license