is-string <sup>Version Badge</sup>

github actions coverage dependency status dev dependency status License Downloads

npm badge

Is this value a JS String object or primitive? This module works cross-realm/iframe, and despite ES6 @@toStringTag.

Example

var isString = require('is-string');
var assert = require('assert');

assert.notOk(isString(undefined));
assert.notOk(isString(null));
assert.notOk(isString(false));
assert.notOk(isString(true));
assert.notOk(isString(function () {}));
assert.notOk(isString([]));
assert.notOk(isString({}));
assert.notOk(isString(/a/g));
assert.notOk(isString(new RegExp('a', 'g')));
assert.notOk(isString(new Date()));
assert.notOk(isString(42));
assert.notOk(isString(NaN));
assert.notOk(isString(Infinity));
assert.notOk(isString(new Number(42)));

assert.ok(isString('foo'));
assert.ok(isString(Object('foo')));

Tests

Simply clone the repo, npm install, and run npm test

is-string - Installation

To install is-string via this registry, you'll need to install via the --registry parameter with your package manager.

n

NPM

npm install is-string --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Yarn

yarn config set registry https://js.registry.sudovanilla.org
yarn install is-string

Learn more about the config option.

PNPM

pnpm install is-string --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Bun Logo

Bun

bun install is-string --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Learn more about setting this up in your bunfig.toml configuration.


For Deno, add the following to your .npmrc file in your directory:

registry="https://js.registry.sudovanilla.org"

Then run the deno install command.

is-string - Download

Download Tarball (v1.1.1)

Integrity sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==
SHASUM 92ea3f3d5c5b6e039ca8677e5ac8d07ea773cbb9
Tarball https://js.registry.sudovanilla.org/is-string/-/is-string-1.1.1.tgz