pax_global_header00006660000000000000000000000064141031050340014501gustar00rootroot0000000000000052 comment=e8a5b6d659f59e744ae03b2557e0482cd69194b3 is-string-1.0.7/000077500000000000000000000000001410310503400134255ustar00rootroot00000000000000is-string-1.0.7/.eslintignore000066400000000000000000000000121410310503400161210ustar00rootroot00000000000000coverage/ is-string-1.0.7/.eslintrc000066400000000000000000000003311410310503400152460ustar00rootroot00000000000000{ "root": true, "extends": "@ljharb", "rules": { "func-name-matching": 0, "max-statements": [2, 15] }, "overrides": [ { "files": ["test.js"], "rules": { "no-magic-numbers": 0, }, }, ], } is-string-1.0.7/.github/000077500000000000000000000000001410310503400147655ustar00rootroot00000000000000is-string-1.0.7/.github/FUNDING.yml000066400000000000000000000011041410310503400165760ustar00rootroot00000000000000# These are supported funding model platforms github: [ljharb] patreon: # Replace with a single Patreon username open_collective: # Replace with a single Open Collective username ko_fi: # Replace with a single Ko-fi username tidelift: npm/is-string community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] is-string-1.0.7/.github/workflows/000077500000000000000000000000001410310503400170225ustar00rootroot00000000000000is-string-1.0.7/.github/workflows/node-4+.yml000066400000000000000000000030111410310503400207010ustar00rootroot00000000000000name: 'Tests: node.js' on: [pull_request, push] jobs: matrix: runs-on: ubuntu-latest outputs: latest: ${{ steps.set-matrix.outputs.requireds }} minors: ${{ steps.set-matrix.outputs.optionals }} steps: - uses: ljharb/actions/node/matrix@main id: set-matrix with: preset: '>=4' latest: needs: [matrix] name: 'latest minors' runs-on: ubuntu-latest strategy: fail-fast: false matrix: ${{ fromJson(needs.matrix.outputs.latest) }} steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/install@main name: 'nvm install ${{ matrix.node-version }} && npm install' with: node-version: ${{ matrix.node-version }} - run: npm run tests-only - uses: codecov/codecov-action@v1 minors: needs: [matrix, latest] name: 'non-latest minors' continue-on-error: true if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: ${{ fromJson(needs.matrix.outputs.minors) }} steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/install@main name: 'nvm install ${{ matrix.node-version }} && npm install' with: node-version: ${{ matrix.node-version }} - run: npm run tests-only - uses: codecov/codecov-action@v1 node: name: 'node 4+' needs: [latest, minors] runs-on: ubuntu-latest steps: - run: 'echo tests completed' is-string-1.0.7/.github/workflows/node-iojs.yml000066400000000000000000000034651410310503400214440ustar00rootroot00000000000000name: 'Tests: node.js (io.js)' on: [pull_request, push] jobs: matrix: runs-on: ubuntu-latest outputs: latest: ${{ steps.set-matrix.outputs.requireds }} minors: ${{ steps.set-matrix.outputs.optionals }} steps: - uses: ljharb/actions/node/matrix@main id: set-matrix with: versionsAsRoot: true preset: 'iojs' latest: needs: [matrix] name: 'latest minors' runs-on: ubuntu-latest strategy: fail-fast: false matrix: node-version: ${{ fromJson(needs.matrix.outputs.latest) }} command: - 'tests-only' - 'test:corejs' steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/install@main name: 'nvm install ${{ matrix.node-version }} && npm install' with: node-version: ${{ matrix.node-version }} skip-ls-check: true - run: npm run ${{ matrix.command }} - uses: codecov/codecov-action@v1 minors: needs: [matrix, latest] name: 'non-latest minors' continue-on-error: true if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: node-version: ${{ fromJson(needs.matrix.outputs.minors) }} command: - 'tests-only' - 'test:corejs' steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/install@main name: 'nvm install ${{ matrix.node-version }} && npm install' with: node-version: ${{ matrix.node-version }} skip-ls-check: true - run: npm run ${{ matrix.command }} - uses: codecov/codecov-action@v1 node: name: 'io.js' needs: [latest, minors] runs-on: ubuntu-latest steps: - run: 'echo tests completed' is-string-1.0.7/.github/workflows/node-pretest.yml000066400000000000000000000011021410310503400221500ustar00rootroot00000000000000name: 'Tests: pretest/posttest' on: [pull_request, push] jobs: pretest: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/install@main name: 'nvm install lts/* && npm install' with: node-version: 'lts/*' - run: npm run pretest posttest: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/install@main name: 'nvm install lts/* && npm install' with: node-version: 'lts/*' - run: npm run posttest is-string-1.0.7/.github/workflows/node-zero.yml000066400000000000000000000040331410310503400214470ustar00rootroot00000000000000name: 'Tests: node.js (0.x)' on: [pull_request, push] jobs: matrix: runs-on: ubuntu-latest outputs: stable: ${{ steps.set-matrix.outputs.requireds }} unstable: ${{ steps.set-matrix.outputs.optionals }} steps: - uses: ljharb/actions/node/matrix@main id: set-matrix with: versionsAsRoot: true preset: '0.x' stable: needs: [matrix] name: 'stable minors' runs-on: ubuntu-latest strategy: fail-fast: false matrix: node-version: ${{ fromJson(needs.matrix.outputs.stable) }} command: - 'tests-only' - 'test:corejs' steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/install@main name: 'nvm install ${{ matrix.node-version }} && npm install' with: node-version: ${{ matrix.node-version }} cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }} skip-ls-check: true - run: npm run ${{ matrix.command }} - uses: codecov/codecov-action@v1 unstable: needs: [matrix, stable] name: 'unstable minors' continue-on-error: true if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: node-version: ${{ fromJson(needs.matrix.outputs.unstable) }} command: - 'tests-only' - 'test:corejs' steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/install@main name: 'nvm install ${{ matrix.node-version }} && npm install' with: node-version: ${{ matrix.node-version }} cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }} skip-ls-check: true - run: npm run ${{ matrix.command }} - uses: codecov/codecov-action@v1 node: name: 'node 0.x' needs: [stable, unstable] runs-on: ubuntu-latest steps: - run: 'echo tests completed' is-string-1.0.7/.github/workflows/rebase.yml000066400000000000000000000004011410310503400210010ustar00rootroot00000000000000name: Automatic Rebase on: [pull_request_target] jobs: _: name: "Automatic Rebase" runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: ljharb/rebase@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} is-string-1.0.7/.github/workflows/require-allow-edits.yml000066400000000000000000000003011410310503400234350ustar00rootroot00000000000000name: Require “Allow Edits” on: [pull_request_target] jobs: _: name: "Require “Allow Edits”" runs-on: ubuntu-latest steps: - uses: ljharb/require-allow-edits@main is-string-1.0.7/.gitignore000066400000000000000000000012541410310503400154170ustar00rootroot00000000000000# Logs logs *.log # Runtime data pids *.pid *.seed # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage/ .nyc_output/ # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) .grunt # Compiled binary addons (http://nodejs.org/api/addons.html) build/Release # Dependency directory # Commenting this out is preferred by some people, see # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- node_modules # Users Environment Variables .lock-wscript # Only apps should have lockfiles npm-shrinkwrap.json package-lock.json yarn.lock is-string-1.0.7/.npmignore000066400000000000000000000013161410310503400154250ustar00rootroot00000000000000# Logs logs *.log # Runtime data pids *.pid *.seed # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage/ .nyc_output/ # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) .grunt # Compiled binary addons (http://nodejs.org/api/addons.html) build/Release # Dependency directory # Commenting this out is preferred by some people, see # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- node_modules # Users Environment Variables .lock-wscript # Only apps should have lockfiles npm-shrinkwrap.json package-lock.json yarn.lock .github/workflows test-corejs.js is-string-1.0.7/.npmrc000066400000000000000000000000671410310503400145500ustar00rootroot00000000000000package-lock=false allow-same-version=true message=v%s is-string-1.0.7/.nycrc000066400000000000000000000002371410310503400145460ustar00rootroot00000000000000{ "all": true, "check-coverage": false, "reporter": ["text-summary", "text", "html", "json"], "exclude": [ "coverage", "test", "test-corejs.js" ] } is-string-1.0.7/CHANGELOG.md000066400000000000000000000253001410310503400152360ustar00rootroot00000000000000# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). ## [v1.0.7](https://github.com/inspect-js/is-string/compare/v1.0.6...v1.0.7) - 2021-08-05 ### Commits - [Refactor] use `has-tostringtag` to behave correctly in the presence of symbol shams [`d973ffd`](https://github.com/inspect-js/is-string/commit/d973ffd2268e10c0e2cd4f0c57ecf8ce0a8d8578) - [Dev Deps] update `auto-changelog`, `core-js`, `eslint`, `tape` [`4bfaabf`](https://github.com/inspect-js/is-string/commit/4bfaabf877e874ca21d2c44be26f13add8ee2761) ## [v1.0.6](https://github.com/inspect-js/is-string/compare/v1.0.5...v1.0.6) - 2021-05-07 ### Commits - [Tests] migrate tests to Github Actions [`c7790c8`](https://github.com/inspect-js/is-string/commit/c7790c89e5077251fe7ca32ac29eeee02f1b2751) - [actions] use `node/install` instead of `node/run`; use `codecov` action [`1e52bbd`](https://github.com/inspect-js/is-string/commit/1e52bbd19b1608f6932c0335d9981824584c3186) - [Fix] do not use `Object.prototype.toString` when `Symbol.toStringTag` is shammed [`83337eb`](https://github.com/inspect-js/is-string/commit/83337ebf55308b7bb9c1befae420760e0f8d8016) - [meta] do not publish github action workflow files [`b25aea2`](https://github.com/inspect-js/is-string/commit/b25aea2e8a53ed9e9090cf96481590cdc00a0957) - [readme] update badges [`759ccd9`](https://github.com/inspect-js/is-string/commit/759ccd94de4a2000231a179f91af6b5c12c11e00) - [Tests] run `nyc` on all tests [`dc02f70`](https://github.com/inspect-js/is-string/commit/dc02f7080c355f0d24368c1622db09f7cc30cdbd) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `tape`; add `aud` [`a0f76fa`](https://github.com/inspect-js/is-string/commit/a0f76fa1990bb580948f9e2daa89bdcda3fae7f0) - [actions] add "Allow Edits" workflow [`9ec3902`](https://github.com/inspect-js/is-string/commit/9ec390295b4faef7744d2b579c1050be66168cb7) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`57fbe21`](https://github.com/inspect-js/is-string/commit/57fbe215da83a3b601855a9c6543ad1a96de5702) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`191e55f`](https://github.com/inspect-js/is-string/commit/191e55ff1fa782654ffcce2df922e23345b56690) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog` [`1ea2b81`](https://github.com/inspect-js/is-string/commit/1ea2b81e866775a7890e75c44c742204124aa354) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`105d1b9`](https://github.com/inspect-js/is-string/commit/105d1b9851e366ef23c2a27d4064e0d36da25939) - [Dev Deps] update `auto-changelog`, `tape`; add `aud` [`114cfad`](https://github.com/inspect-js/is-string/commit/114cfad854d8860421f847cd99a3bdb8ef1353dc) - [meta] use `prepublishOnly` script for npm 7+ [`fc38f26`](https://github.com/inspect-js/is-string/commit/fc38f26adb486f50880c5771d145ab2bffb6247a) - [meta] gitignore coverage output [`3419127`](https://github.com/inspect-js/is-string/commit/34191278f1fa09ba4da801a6fd7a32e31050e759) - [actions] update rebase action to use checkout v2 [`334eca0`](https://github.com/inspect-js/is-string/commit/334eca02d40f4cf7dc15a8e7d5ff06852028abb5) - [actions] switch Automatic Rebase workflow to `pull_request_target` event [`7a332e9`](https://github.com/inspect-js/is-string/commit/7a332e963f1ab717fafa671e0fa8a1b20c53d861) - [meta] remove explicit audit level config [`04630b1`](https://github.com/inspect-js/is-string/commit/04630b1b535084322ddeae8efb79a8810d7cf325) ## [v1.0.5](https://github.com/inspect-js/is-string/compare/v1.0.4...v1.0.5) - 2019-12-18 ### Commits - [Tests] use shared travis-ci configs [`4121d6b`](https://github.com/inspect-js/is-string/commit/4121d6b168ae1d54a81791ee6877f9813cab6253) - [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`](https://github.com/inspect-js/is-string/commit/e7a3e89ccb9638d73f45dbcb2a42e509bd3153c4) - Update `eslint`, `tape`, `semver`; use my personal shared `eslint` config [`6c380a7`](https://github.com/inspect-js/is-string/commit/6c380a70011714370e754fa0df95f56cdcaa3e60) - [Tests] remove `jscs` [`3d49592`](https://github.com/inspect-js/is-string/commit/3d49592b9880fcb1a23b67286445281131a553e3) - Update `is`, `tape`, `covert`, `jscs`, `editorconfig-tools`, `eslint`, `nsp`, `semver`. [`cc6983d`](https://github.com/inspect-js/is-string/commit/cc6983d06bc98f4ae9b7c9439d5d73c7318d8acd) - [meta] add `auto-changelog` [`b857897`](https://github.com/inspect-js/is-string/commit/b85789723ce3a7064536598e0fcdd495257c6134) - [meta] remove unused Makefile and associated utilities [`3f0f51c`](https://github.com/inspect-js/is-string/commit/3f0f51cbae1f97dbe1466eee88d105b3df0d2f0a) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `is`, `covert`, `tape`, `semver` [`9d4a95e`](https://github.com/inspect-js/is-string/commit/9d4a95e4473fe8195501878525b5af5948aa45c9) - Update `eslint` [`e861b4b`](https://github.com/inspect-js/is-string/commit/e861b4bc71f5390670aebdff91119a1f8aeeb88a) - Update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`172e2dd`](https://github.com/inspect-js/is-string/commit/172e2dd1a0b9eb042bcb9a80ff5e774a90ff0695) - Test on `node` and `io.js` latest. [`fd426cd`](https://github.com/inspect-js/is-string/commit/fd426cd18b22b0d0e1731598125393dcfe0c5704) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest` [`23bdf83`](https://github.com/inspect-js/is-string/commit/23bdf83cf42138eba09f45bd0b040b069f9839d4) - [actions] add automatic rebasing / merge commit blocking [`96153c0`](https://github.com/inspect-js/is-string/commit/96153c0d687a7fda2261f4c02add5d0b41e8aed7) - [meta] create FUNDING.yml [`66ae246`](https://github.com/inspect-js/is-string/commit/66ae246d6cdaa4ccbc21f7c144b672139b8ccef6) - [Dev Deps] update `is`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver` [`817361a`](https://github.com/inspect-js/is-string/commit/817361a9673cd1ec9854b52578a980159f7d8701) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `semver`, `tape` [`fc35d3f`](https://github.com/inspect-js/is-string/commit/fc35d3feb40921bb22e1639903cb7f2fab77814b) - [Dev Deps] update `jscs` [`886767e`](https://github.com/inspect-js/is-string/commit/886767e04e5ad59ac0bc926a87233cc8546c8b4f) - [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`3410922`](https://github.com/inspect-js/is-string/commit/341092203c11a3b92eee55a7ecb7b8265e8fcecd) - [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`4d6c73b`](https://github.com/inspect-js/is-string/commit/4d6c73b507bcd39050ef71e554069f72fc5b222a) - Update `nsp`, `eslint` [`b11de49`](https://github.com/inspect-js/is-string/commit/b11de4910beee1ffe1e67fbe25ec6707ca796b27) - Update `eslint`, `semver` [`0777977`](https://github.com/inspect-js/is-string/commit/0777977757a85a1db75831d03a14b4b1fde05d7e) - Only apps should have lockfiles [`78b49ff`](https://github.com/inspect-js/is-string/commit/78b49ffd04d4cd8c57d9e7b485421fbf3641b41b) - [meta] add `funding` field [`81328a6`](https://github.com/inspect-js/is-string/commit/81328a6ef3eee989164127e4c0c82f1da73d3567) - [Dev Deps] update `eslint`, `tape` [`fc9a225`](https://github.com/inspect-js/is-string/commit/fc9a225b27935f7c9c2704281d7fddd3614d3cb8) - [Tests] use `eclint` instead of `editorconfig-tools` [`59c2c61`](https://github.com/inspect-js/is-string/commit/59c2c610dbd8e8ca1e4aa3fa9c9f93205cab9b07) - [Dev Deps] Update `tape`, `eslint` [`a429816`](https://github.com/inspect-js/is-string/commit/a429816688e23c81948b4ae72324c26c27849b7c) - Test on `io.js` `v2.2` [`08b476e`](https://github.com/inspect-js/is-string/commit/08b476ed0734a70e3091c04ddd2f173a2df21eb2) - Test up to `io.js` `v3.0` [`22637ef`](https://github.com/inspect-js/is-string/commit/22637ef9e0030533df85cf1992fc099a88b1924c) - [meta] add `safe-publish-latest` [`20ccb48`](https://github.com/inspect-js/is-string/commit/20ccb48fd85f0245eb893507d00003090da020d0) - [Dev Deps] update `tape` [`06b58a0`](https://github.com/inspect-js/is-string/commit/06b58a048c2a820e5611ad2bd9ddfbe893295a57) - Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. [`ea7cf84`](https://github.com/inspect-js/is-string/commit/ea7cf849b952c924d1687a302098251a7b827c80) - Test on `io.js` `v2.4` [`66ec3ea`](https://github.com/inspect-js/is-string/commit/66ec3ea390b364583a792799b53857fd186ccc88) - Test on `io.js` `v2.3` [`ca6e796`](https://github.com/inspect-js/is-string/commit/ca6e796f16ec433b88962162fde8012f28e18f1e) - Fix tests for faked @@toStringTag [`3cce832`](https://github.com/inspect-js/is-string/commit/3cce8329133dfd233987359df151018b3b136be1) ## [v1.0.4](https://github.com/inspect-js/is-string/compare/v1.0.3...v1.0.4) - 2015-01-29 ### Commits - If @@toStringTag is not present, use the old-school Object#toString test. [`30675ec`](https://github.com/inspect-js/is-string/commit/30675ecb5c5cc43873918661a414a1d0f8b77325) ## [v1.0.3](https://github.com/inspect-js/is-string/compare/v1.0.2...v1.0.3) - 2015-01-29 ### Commits - Refactor to aid optimization of non-try/catch code. [`9b2772a`](https://github.com/inspect-js/is-string/commit/9b2772abe09ba8cbaa631322cc226ee906d2db22) ## [v1.0.2](https://github.com/inspect-js/is-string/compare/v1.0.1...v1.0.2) - 2015-01-29 ### Commits - Fix broken package.json [`dc921d3`](https://github.com/inspect-js/is-string/commit/dc921d332b64e4041162f04e4712b0dc687863a5) ## [v1.0.1](https://github.com/inspect-js/is-string/compare/v1.0.0...v1.0.1) - 2015-01-29 ### Commits - Fix eslint config. [`c4e05bd`](https://github.com/inspect-js/is-string/commit/c4e05bd171da6002d432e451fd48912db8b048e0) - Add early exits for typeof "string", or typeof not "object". [`82f41d3`](https://github.com/inspect-js/is-string/commit/82f41d36a599bc6a06152792c84c7683e412c513) ## v1.0.0 - 2015-01-29 ### Commits - Dotfiles. [`45bc9dd`](https://github.com/inspect-js/is-string/commit/45bc9dd60201722344986a6c7536be9ea9ccefbf) - `make release` [`23707f5`](https://github.com/inspect-js/is-string/commit/23707f5ecfdf00afb0e57c06ac07f7f49cdeb606) - package.json [`575ad81`](https://github.com/inspect-js/is-string/commit/575ad811c61b156cfbcc60ff61947183c6ebe6a2) - Read me [`3f67c9a`](https://github.com/inspect-js/is-string/commit/3f67c9a0725f811845d38646a19322895cd03981) - Initial commit [`2c26a7a`](https://github.com/inspect-js/is-string/commit/2c26a7a2e41dec77be2c59d5847f29a6ab7c0b29) - Tests. [`38c987b`](https://github.com/inspect-js/is-string/commit/38c987b8513b0ac03b0897e0fce7de8135d4ee0f) - Implementation. [`0471d59`](https://github.com/inspect-js/is-string/commit/0471d59078d7f3f77619913ec21c57c0af27114c) is-string-1.0.7/LICENSE000066400000000000000000000020721410310503400144330ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2015 Jordan Harband Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. is-string-1.0.7/README.md000066400000000000000000000040201410310503400147000ustar00rootroot00000000000000# is-string [![Version Badge][2]][1] [![github actions][actions-image]][actions-url] [![coverage][codecov-image]][codecov-url] [![dependency status][5]][6] [![dev dependency status][7]][8] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![npm badge][11]][1] Is this value a JS String object or primitive? This module works cross-realm/iframe, and despite ES6 @@toStringTag. ## Example ```js 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` [1]: https://npmjs.org/package/is-string [2]: https://versionbadg.es/inspect-js/is-string.svg [5]: https://david-dm.org/inspect-js/is-string.svg [6]: https://david-dm.org/inspect-js/is-string [7]: https://david-dm.org/inspect-js/is-string/dev-status.svg [8]: https://david-dm.org/inspect-js/is-string#info=devDependencies [11]: https://nodei.co/npm/is-string.png?downloads=true&stars=true [license-image]: https://img.shields.io/npm/l/is-string.svg [license-url]: LICENSE [downloads-image]: https://img.shields.io/npm/dm/is-string.svg [downloads-url]: https://npm-stat.com/charts.html?package=is-string [codecov-image]: https://codecov.io/gh/inspect-js/is-string/branch/main/graphs/badge.svg [codecov-url]: https://app.codecov.io/gh/inspect-js/is-string/ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-string [actions-url]: https://github.com/inspect-js/is-string/actions is-string-1.0.7/index.js000066400000000000000000000010601410310503400150670ustar00rootroot00000000000000'use strict'; var strValue = String.prototype.valueOf; var tryStringObject = function tryStringObject(value) { try { strValue.call(value); return true; } catch (e) { return false; } }; var toStr = Object.prototype.toString; var strClass = '[object String]'; var hasToStringTag = require('has-tostringtag/shams')(); module.exports = function isString(value) { if (typeof value === 'string') { return true; } if (typeof value !== 'object') { return false; } return hasToStringTag ? tryStringObject(value) : toStr.call(value) === strClass; }; is-string-1.0.7/package.json000066400000000000000000000040641410310503400157170ustar00rootroot00000000000000{ "name": "is-string", "version": "1.0.7", "author": "Jordan Harband ", "funding": { "url": "https://github.com/sponsors/ljharb" }, "description": "Is this value a JS String object or primitive? This module works cross-realm/iframe, and despite ES6 @@toStringTag.", "license": "MIT", "main": "index.js", "scripts": { "prepublishOnly": "safe-publish-latest", "prepublish": "not-in-publish || npm run prepublishOnly", "pretest": "npm run lint", "tests-only": "nyc tape 'test/**/*.js'", "test:corejs": "nyc tape test-corejs.js", "test": "npm run tests-only && npm run test:corejs", "posttest": "npx aud --production", "lint": "eslint .", "eccheck": "eclint check *.js **/*.js > /dev/null", "version": "auto-changelog && git add CHANGELOG.md", "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" }, "repository": { "type": "git", "url": "git://github.com/ljharb/is-string.git" }, "keywords": [ "String", "string", "ES6", "toStringTag", "@@toStringTag", "String object" ], "dependencies": { "has-tostringtag": "^1.0.0" }, "devDependencies": { "@ljharb/eslint-config": "^17.6.0", "aud": "^1.1.5", "auto-changelog": "^2.3.0", "core-js": "^3.16.0", "eclint": "^2.8.1", "eslint": "^7.32.0", "foreach": "^2.0.5", "indexof": "^0.0.1", "is": "^3.3.0", "nyc": "^10.3.2", "safe-publish-latest": "^1.1.4", "tape": "^5.3.0" }, "testling": { "files": "test/index.js", "browsers": [ "iexplore/6.0..latest", "firefox/3.0..6.0", "firefox/15.0..latest", "firefox/nightly", "chrome/4.0..10.0", "chrome/20.0..latest", "chrome/canary", "opera/10.0..latest", "opera/next", "safari/4.0..latest", "ipad/6.0..latest", "iphone/6.0..latest", "android-browser/4.2" ] }, "engines": { "node": ">= 0.4" }, "auto-changelog": { "output": "CHANGELOG.md", "template": "keepachangelog", "unreleased": false, "commitLimit": false, "backfillLimit": false } } is-string-1.0.7/test-corejs.js000066400000000000000000000000671410310503400162300ustar00rootroot00000000000000'use strict'; require('core-js'); require('./test'); is-string-1.0.7/test/000077500000000000000000000000001410310503400144045ustar00rootroot00000000000000is-string-1.0.7/test/index.js000066400000000000000000000026031410310503400160520ustar00rootroot00000000000000'use strict'; var test = require('tape'); var isString = require('../'); var hasToStringTag = require('has-tostringtag/shams')(); test('not Strings', function (t) { t.notOk(isString(), 'undefined is not String'); t.notOk(isString(null), 'null is not String'); t.notOk(isString(false), 'false is not String'); t.notOk(isString(true), 'true is not String'); t.notOk(isString([]), 'array is not String'); t.notOk(isString({}), 'object is not String'); t.notOk(isString(function () {}), 'function is not String'); t.notOk(isString(/a/g), 'regex literal is not String'); t.notOk(isString(new RegExp('a', 'g')), 'regex object is not String'); t.notOk(isString(new Date()), 'new Date() is not String'); t.notOk(isString(42), 'number is not String'); t.notOk(isString(Object(42)), 'number object is not String'); t.notOk(isString(NaN), 'NaN is not String'); t.notOk(isString(Infinity), 'Infinity is not String'); t.end(); }); test('@@toStringTag', { skip: !hasToStringTag }, function (t) { var fakeString = { toString: function () { return '7'; }, valueOf: function () { return '42'; } }; fakeString[Symbol.toStringTag] = 'String'; t.notOk(isString(fakeString), 'fake String with @@toStringTag "String" is not String'); t.end(); }); test('Strings', function (t) { t.ok(isString('foo'), 'string primitive is String'); t.ok(isString(Object('foo')), 'string object is String'); t.end(); });