@fvilers/is-set
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

@fvilers/is-set

A TypeScript type guard that validates if the given value is a Set

Installation

npm install @fvilers/is-set

or

yarn add @fvilers/is-set

ECMAScript module

Starting with version 2.0.0, this library will be published as an ECMAScript module.

Usage

import { isSet } from "@fvilers/is-set";

const variable: any = new Set();

if (isSet(variable)) {
  // From here, variable is strongly typed as a Set
  console.log("Variable is a set with size of", set.size);
} else {
  console.log("Variable is not a set");
}
Variable is a set with size of 0

/@fvilers/is-set/

    Package Sidebar

    Install

    npm i @fvilers/is-set

    Weekly Downloads

    0

    Version

    2.0.1

    License

    MIT

    Unpacked Size

    4.02 kB

    Total Files

    13

    Last publish

    Collaborators

    • fvilers