Package detail

is-string

inspect-js166.8mMIT1.1.1

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

String, string, ES6, toStringTag

readme

is-string Version Badge

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

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Generated by auto-changelog.

v1.1.1 - 2024-12-15

Commits

  • [Dev Deps] update @arethetypeswrong/cli, @ljharb/tsconfig, @types/tape c1f7ef7
  • [Refactor] use call-bound directly ba8a78f
  • [Deps] update call-bind 93c352f

v1.1.0 - 2024-12-01

Commits

  • [actions] reuse common workflows 12aa75b
  • [meta] use npmignore to autogenerate an npmignore file 6401572
  • [actions] split out node 10-20, and 20+ 223540c
  • [New] add types 7e83d67
  • [Dev Deps] update eslint, @ljharb/eslint-config, core-js, safe-publish-latest, tape febd26e
  • [readme] add github actions/codecov badges; update URLs f6bf065
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, core-js, tape 8afc37a
  • [Robustness] use call-bind ac86dd7
  • [actions] update rebase action to use reusable workflow 77058c8
  • [actions] update codecov uploader 4312be5
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, core-js, tape 98c3779
  • [Dev Deps] update @ljharb/eslint-config, auto-changelog, core-js, npmignore, tape 7d8e0e5
  • [Dev Deps] update eslint, @ljharb/eslint-config, core-js, safe-publish-latest, tape 3284ad1
  • [Tests] replace aud with npm audit 8cb7ea7
  • [Refactor] skip expensive check, for null 20fde50
  • [Deps] update has-tostringtag b67a78d
  • [meta] fix repo URL 1a2ee6b
  • [meta] better eccheck command 6913c75
  • [Dev Deps] add missing peer dep 8ac8551

v1.0.7 - 2021-08-05

Commits

  • [Refactor] use has-tostringtag to behave correctly in the presence of symbol shams d973ffd
  • [Dev Deps] update auto-changelog, core-js, eslint, tape 4bfaabf

v1.0.6 - 2021-05-07

Commits

  • [Tests] migrate tests to Github Actions c7790c8
  • [actions] use node/install instead of node/run; use codecov action 1e52bbd
  • [Fix] do not use Object.prototype.toString when Symbol.toStringTag is shammed 83337eb
  • [meta] do not publish github action workflow files b25aea2
  • [readme] update badges 759ccd9
  • [Tests] run nyc on all tests dc02f70
  • [Dev Deps] update eslint, @ljharb/eslint-config, auto-changelog, tape; add aud a0f76fa
  • [actions] add "Allow Edits" workflow 9ec3902
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, tape 57fbe21
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape 191e55f
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog 1ea2b81
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape 105d1b9
  • [Dev Deps] update auto-changelog, tape; add aud 114cfad
  • [meta] use prepublishOnly script for npm 7+ fc38f26
  • [meta] gitignore coverage output 3419127
  • [actions] update rebase action to use checkout v2 334eca0
  • [actions] switch Automatic Rebase workflow to pull_request_target event 7a332e9
  • [meta] remove explicit audit level config 04630b1

v1.0.5 - 2019-12-18

Commits

  • [Tests] use shared travis-ci configs 4121d6b
  • [Tests] up to node v12.4, v11.15, v10.15, v9.11, v8.15, v7.10, v6.17, v5.12, v4.9; use nvm install-latest-npm e7a3e89
  • Update eslint, tape, semver; use my personal shared eslint config 6c380a7
  • [Tests] remove jscs 3d49592
  • Update is, tape, covert, jscs, editorconfig-tools, eslint, nsp, semver. cc6983d
  • [meta] add auto-changelog b857897
  • [meta] remove unused Makefile and associated utilities 3f0f51c
  • [Dev Deps] update eslint, @ljharb/eslint-config, is, covert, tape, semver 9d4a95e
  • Update eslint e861b4b
  • Update tape, jscs, eslint, @ljharb/eslint-config 172e2dd
  • Test on node and io.js latest. fd426cd
  • [Dev Deps] update eslint, @ljharb/eslint-config, safe-publish-latest 23bdf83
  • [actions] add automatic rebasing / merge commit blocking 96153c0
  • [meta] create FUNDING.yml 66ae246
  • [Dev Deps] update is, jscs, nsp, eslint, @ljharb/eslint-config, semver 817361a
  • [Dev Deps] update eslint, @ljharb/eslint-config, safe-publish-latest, semver, tape fc35d3f
  • [Dev Deps] update jscs 886767e
  • [Tests] use npx aud instead of nsp or npm audit with hoops 3410922
  • [Tests] up to io.js v3.3, node v4.1 4d6c73b
  • Update nsp, eslint b11de49
  • Update eslint, semver 0777977
  • Only apps should have lockfiles 78b49ff
  • [meta] add funding field 81328a6
  • [Dev Deps] update eslint, tape fc9a225
  • [Tests] use eclint instead of editorconfig-tools 59c2c61
  • [Dev Deps] Update tape, eslint a429816
  • Test on io.js v2.2 08b476e
  • Test up to io.js v3.0 22637ef
  • [meta] add safe-publish-latest 20ccb48
  • [Dev Deps] update tape 06b58a0
  • Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. ea7cf84
  • Test on io.js v2.4 66ec3ea
  • Test on io.js v2.3 ca6e796
  • Fix tests for faked @@toStringTag 3cce832

v1.0.4 - 2015-01-29

Commits

  • If @@toStringTag is not present, use the old-school Object#toString test. 30675ec

v1.0.3 - 2015-01-29

Commits

  • Refactor to aid optimization of non-try/catch code. 9b2772a

v1.0.2 - 2015-01-29

Commits

v1.0.1 - 2015-01-29

Commits

  • Fix eslint config. c4e05bd
  • Add early exits for typeof "string", or typeof not "object". 82f41d3

v1.0.0 - 2015-01-29

Commits