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

2.0.0 • Public • Published

@fvilers/is-string

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

Installation

npm install @fvilers/is-string

or

yarn add @fvilers/is-string

ECMAScript module

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

Usage

import { isString } from "@fvilers/is-string";

const variable: any = "This is a string";

if (isString(variable)) {
  // From here, variable is strongly typed as a string
  console.log("Variable is a string with length of", variable.length);
} else {
  console.log("Variable is not a string");
}

It will output:

Variable is a string with length of 16

Package Sidebar

Install

npm i @fvilers/is-string

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

2.86 kB

Total Files

7

Last publish

Collaborators

  • fvilers