├── .editorconfig ├── .eslintrc ├── .github ├── FUNDING.yml └── workflows │ ├── node-aught.yml │ ├── node-pretest.yml │ ├── node-tens.yml │ ├── node-twenties.yml │ ├── rebase.yml │ └── require-allow-edits.yml ├── .gitignore ├── .npmrc ├── .nycrc ├── CHANGELOG.md ├── LICENSE ├── README.md ├── index.d.ts ├── index.js ├── package.json ├── test └── index.js └── tsconfig.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | 4 | "extends": "@ljharb", 5 | 6 | "rules": { 7 | "no-magic-numbers": 0 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: ljharb 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: npm/is-negative-zero 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/workflows/node-aught.yml: -------------------------------------------------------------------------------- 1 | name: 'Tests: node.js < 10' 2 | 3 | on: [pull_request, push] 4 | 5 | permissions: 6 | contents: read 7 | 8 | jobs: 9 | tests: 10 | uses: ljharb/actions/.github/workflows/node.yml@main 11 | with: 12 | range: '< 10' 13 | type: minors 14 | command: npm run tests-only 15 | 16 | node: 17 | name: 'node < 10' 18 | needs: [tests] 19 | runs-on: ubuntu-latest 20 | steps: 21 | - run: true 22 | -------------------------------------------------------------------------------- /.github/workflows/node-pretest.yml: -------------------------------------------------------------------------------- 1 | name: 'Tests: pretest/posttest' 2 | 3 | on: [pull_request, push] 4 | 5 | permissions: 6 | contents: read 7 | 8 | jobs: 9 | tests: 10 | uses: ljharb/actions/.github/workflows/pretest.yml@main 11 | -------------------------------------------------------------------------------- /.github/workflows/node-tens.yml: -------------------------------------------------------------------------------- 1 | name: 'Tests: node.js 10 - 20' 2 | 3 | on: [pull_request, push] 4 | 5 | permissions: 6 | contents: read 7 | 8 | jobs: 9 | tests: 10 | uses: ljharb/actions/.github/workflows/node.yml@main 11 | with: 12 | range: '>= 10 < 20' 13 | type: minors 14 | command: npm run tests-only 15 | 16 | node: 17 | name: 'node 10 - 20' 18 | needs: [tests] 19 | runs-on: ubuntu-latest 20 | steps: 21 | - run: true 22 | -------------------------------------------------------------------------------- /.github/workflows/node-twenties.yml: -------------------------------------------------------------------------------- 1 | name: 'Tests: node.js >= 20' 2 | 3 | on: [pull_request, push] 4 | 5 | permissions: 6 | contents: read 7 | 8 | jobs: 9 | tests: 10 | uses: ljharb/actions/.github/workflows/node.yml@main 11 | with: 12 | range: '>= 20' 13 | type: minors 14 | command: npm run tests-only 15 | 16 | node: 17 | name: 'node >= 20' 18 | needs: [tests] 19 | runs-on: ubuntu-latest 20 | steps: 21 | - run: true 22 | -------------------------------------------------------------------------------- /.github/workflows/rebase.yml: -------------------------------------------------------------------------------- 1 | name: Automatic Rebase 2 | 3 | on: [pull_request_target] 4 | 5 | jobs: 6 | _: 7 | uses: ljharb/actions/.github/workflows/rebase.yml@main 8 | secrets: 9 | token: ${{ secrets.GITHUB_TOKEN }} 10 | -------------------------------------------------------------------------------- /.github/workflows/require-allow-edits.yml: -------------------------------------------------------------------------------- 1 | name: Require “Allow Edits” 2 | 3 | on: [pull_request_target] 4 | 5 | permissions: 6 | contents: read 7 | 8 | jobs: 9 | _: 10 | permissions: 11 | pull-requests: read # for ljharb/require-allow-edits to check 'allow edits' on PR 12 | 13 | name: "Require “Allow Edits”" 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: ljharb/require-allow-edits@main 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # gitignore 2 | 3 | lib-cov 4 | *.seed 5 | *.log 6 | *.csv 7 | *.dat 8 | *.out 9 | *.pid 10 | *.gz 11 | 12 | pids 13 | logs 14 | results 15 | 16 | npm-debug.log 17 | node_modules 18 | 19 | # Only apps should have lockfiles 20 | npm-shrinkwrap.json 21 | package-lock.json 22 | yarn.lock 23 | 24 | coverage/ 25 | .nyc_output/ 26 | 27 | .npmignore 28 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | allow-same-version=true 3 | message=v%s 4 | -------------------------------------------------------------------------------- /.nycrc: -------------------------------------------------------------------------------- 1 | { 2 | "all": true, 3 | "check-coverage": false, 4 | "reporter": ["text-summary", "text", "html", "json"], 5 | "exclude": [ 6 | "coverage", 7 | "test" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [v2.0.3](https://github.com/inspect-js/is-negative-zero/compare/v2.0.2...v2.0.3) - 2024-02-19 9 | 10 | ### Commits 11 | 12 | - add types [`e28f0d5`](https://github.com/inspect-js/is-negative-zero/commit/e28f0d59cffc61bd3d41c10563105e8adb868e59) 13 | - [meta] use `npmignore` to autogenerate an npmignore file [`f68ec13`](https://github.com/inspect-js/is-negative-zero/commit/f68ec13c1d04a2ef1e1c72506ae9c2ac0567bcdd) 14 | - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`70abff7`](https://github.com/inspect-js/is-negative-zero/commit/70abff788bb0156f300a09c2f5cc7d30d5618184) 15 | - [actions] update rebase action to use reusable workflow [`6e1356e`](https://github.com/inspect-js/is-negative-zero/commit/6e1356e9fc5fee1bcae20b365c7d71b14ecf876d) 16 | - [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `tape` [`c00d4ab`](https://github.com/inspect-js/is-negative-zero/commit/c00d4ab5c381d22ac3e6d89180b3e012c479f13f) 17 | - [meta] add `sideEffects` flag [`9c45539`](https://github.com/inspect-js/is-negative-zero/commit/9c455398988d2db940fe6644541d09d510b6661f) 18 | 19 | ## [v2.0.2](https://github.com/inspect-js/is-negative-zero/compare/v2.0.1...v2.0.2) - 2021-12-10 20 | 21 | ### Commits 22 | 23 | - [actions] reuse common workflows [`ece923d`](https://github.com/inspect-js/is-negative-zero/commit/ece923d6b50820b7832150957774047da43d1743) 24 | - [actions] use `node/install` instead of `node/run`; use `codecov` action [`3a26f43`](https://github.com/inspect-js/is-negative-zero/commit/3a26f435434bbfb8a254ddd32d6079bf50263121) 25 | - [meta] do not publish workflow files [`2cea0c2`](https://github.com/inspect-js/is-negative-zero/commit/2cea0c20c7f8b167bb6064f916f3285642bf5ab1) 26 | - [readme] add github actions/codecov badges; update URLs [`0c0be3e`](https://github.com/inspect-js/is-negative-zero/commit/0c0be3eb148ccf9d764e8ed515ef0e1d0ffeed9d) 27 | - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`a93d16e`](https://github.com/inspect-js/is-negative-zero/commit/a93d16eddf46cad6bc9b71a92968ce758e6f4ea4) 28 | - [meta] create FUNDING.yml [`b4f425e`](https://github.com/inspect-js/is-negative-zero/commit/b4f425e49edb8c4aa1efa6ba34c2d5c1150b2a26) 29 | - [actions] update codecov uploader [`7999db3`](https://github.com/inspect-js/is-negative-zero/commit/7999db3bff3f0f9cc729529940b9077a586822e2) 30 | - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `safe-publish-latest`, `tape` [`140e4d9`](https://github.com/inspect-js/is-negative-zero/commit/140e4d95eda9ad821608c28a5f705d84a906096d) 31 | - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`23a8b6d`](https://github.com/inspect-js/is-negative-zero/commit/23a8b6d257cea0b8a608b2319739562ecbc6ba75) 32 | - [readme] add actions and codecov badges [`fe92126`](https://github.com/inspect-js/is-negative-zero/commit/fe9212634346ced7a45905d958cb85d129e4c10b) 33 | - [readme] fix repo URLs [`50c428e`](https://github.com/inspect-js/is-negative-zero/commit/50c428e423e5861a6c231440b8b3e746cbf6230f) 34 | - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`688155f`](https://github.com/inspect-js/is-negative-zero/commit/688155ff0214da72cbafa4c438c3b9629265d82b) 35 | - [meta] use `prepublishOnly` script for npm 7+ [`83171f9`](https://github.com/inspect-js/is-negative-zero/commit/83171f9131aed266f475d7a3283d9c2fc77e1436) 36 | - [actions] update workflows [`e9823db`](https://github.com/inspect-js/is-negative-zero/commit/e9823db3054887d8bb5b3f2c8f698b93cdce7d82) 37 | 38 | ## [v2.0.1](https://github.com/inspect-js/is-negative-zero/compare/v2.0.0...v2.0.1) - 2020-12-04 39 | 40 | ### Commits 41 | 42 | - [Tests] use shared travis-ci configs [`5b92482`](https://github.com/inspect-js/is-negative-zero/commit/5b92482ed26e55e1aafcc6b6310d279958af8204) 43 | - [Tests] up to `node` `v11.7`, `v10.15`, `v9.11`, `v8.15`, `v7.10`, `v6.16`, `v5.12`, `v4.9`; use `nvm install-latest-npm`; fix test scripts [`0f5d2f8`](https://github.com/inspect-js/is-negative-zero/commit/0f5d2f85ea7fe83de47f39b6b35e489b866d88a7) 44 | - [Tests] migrate tests to Github Actions [`b80f05a`](https://github.com/inspect-js/is-negative-zero/commit/b80f05adb11a6a3232860fb50272b101aacb504f) 45 | - [Tests] remove `jscs` [`7ccaf41`](https://github.com/inspect-js/is-negative-zero/commit/7ccaf4100281b614d61d7c9122e6f87943a89295) 46 | - [meta] add missing changelog [`992bdde`](https://github.com/inspect-js/is-negative-zero/commit/992bddee362cbae71f2cdfd8666f4774b252412e) 47 | - [readme] fix repo URLs; remove defunct badges [`80fd18d`](https://github.com/inspect-js/is-negative-zero/commit/80fd18d2b0191321afe0e1b572200e4c025eb664) 48 | - [Tests] run `nyc` on all tests [`df26f14`](https://github.com/inspect-js/is-negative-zero/commit/df26f14b0b854d82b0d3ca7b4949811c9f151357) 49 | - Update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`d7723aa`](https://github.com/inspect-js/is-negative-zero/commit/d7723aa70e5b478adc36d98e1338abe741c1906a) 50 | - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`9fdaabe`](https://github.com/inspect-js/is-negative-zero/commit/9fdaabecfdb25e6e860e5007a91b60ee0f20734f) 51 | - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `tape` [`f07eeb2`](https://github.com/inspect-js/is-negative-zero/commit/f07eeb2740037c53f270e95d2f62edc051cafc56) 52 | - [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`bd5c751`](https://github.com/inspect-js/is-negative-zero/commit/bd5c751fa4850ba8726dc1c197ed6c843a227b05) 53 | - [actions] add automatic rebasing / merge commit blocking [`5666a91`](https://github.com/inspect-js/is-negative-zero/commit/5666a917db6bdcee63c0a3e28e5e281359975abc) 54 | - [meta] add `auto-changelog` [`f70fb2b`](https://github.com/inspect-js/is-negative-zero/commit/f70fb2b5b9ea53dc52729310717553648292189e) 55 | - [actions] add "Allow Edits" workflow [`2b040a8`](https://github.com/inspect-js/is-negative-zero/commit/2b040a87d362f17d8cab2b0d48058b80e426ad4e) 56 | - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`; add `safe-publish-latest` [`09e2e53`](https://github.com/inspect-js/is-negative-zero/commit/09e2e537390225c1d1a6912be64267eaec6ea367) 57 | - [Tests] use `npm audit` instead of `nsp` [`7df2669`](https://github.com/inspect-js/is-negative-zero/commit/7df2669013ac9328d424e9d8c82a53a0458f0888) 58 | - [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`4ff97c5`](https://github.com/inspect-js/is-negative-zero/commit/4ff97c5891c7a241a91c03fb54bd83e78570ef22) 59 | - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog` [`9e8cb7b`](https://github.com/inspect-js/is-negative-zero/commit/9e8cb7bca46d325ecf202187c0fde7da8722bcab) 60 | - [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config`, `nsp` [`70b9888`](https://github.com/inspect-js/is-negative-zero/commit/70b988802a99c84ab7eb8da287bb8ff0efc5c055) 61 | - [Dev Deps] update `jscs` [`59d0c42`](https://github.com/inspect-js/is-negative-zero/commit/59d0c42131020b74e68fd444798b9a3bf247fb2d) 62 | - Add `npm run security` [`eb418ed`](https://github.com/inspect-js/is-negative-zero/commit/eb418ed7e79216808c206388fbd360cc7a75655f) 63 | - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`86a758d`](https://github.com/inspect-js/is-negative-zero/commit/86a758d42eb7d17a18f7f584c337d8820b842758) 64 | - Only apps should have lockfiles [`a0ab621`](https://github.com/inspect-js/is-negative-zero/commit/a0ab6215590bf6adb3eaf1ff9e7c036d72e807ec) 65 | - [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`5c51349`](https://github.com/inspect-js/is-negative-zero/commit/5c513498fc5a8b2fd06f5e0c1b38b8e93c3477ac) 66 | - [meta] add `funding` field [`1d0b2f4`](https://github.com/inspect-js/is-negative-zero/commit/1d0b2f43bf5bf75176859a440346b3e338ee510e) 67 | - [actions] switch Automatic Rebase workflow to `pull_request_target` event [`9b12367`](https://github.com/inspect-js/is-negative-zero/commit/9b12367706f1c269a3df406c8e2c211558671a15) 68 | - [Dev Deps] update `auto-changelog`, `tape` [`6d98b8d`](https://github.com/inspect-js/is-negative-zero/commit/6d98b8d1f512c3844d4062215c793070084d1164) 69 | - [Dev Deps] Update `tape`, `eslint` [`a258cdb`](https://github.com/inspect-js/is-negative-zero/commit/a258cdb86691725482d1d43a1f9e7953c3c6733f) 70 | - [Dev Deps] update `auto-changelog`; add `aud` [`2ca2afb`](https://github.com/inspect-js/is-negative-zero/commit/2ca2afb9efef4ebc8b3c19046ab1ab3ad516ea9a) 71 | - Test up to `io.js` `v3.0` [`1254ae8`](https://github.com/inspect-js/is-negative-zero/commit/1254ae80b7706616331ac914654d7a17bff31039) 72 | - [Dev Deps] update `auto-changelog` [`4b54722`](https://github.com/inspect-js/is-negative-zero/commit/4b547228fceaae8f9eccabc9ad8a49046492348d) 73 | - [Tests] only audit prod deps [`86d298b`](https://github.com/inspect-js/is-negative-zero/commit/86d298b56db90f81617ee5d942476eda34afb374) 74 | - [Dev Deps] update `tape` [`3a47e27`](https://github.com/inspect-js/is-negative-zero/commit/3a47e2730f889539f666ef0eb09a93fb9c80bfd1) 75 | - Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. [`128d9bd`](https://github.com/inspect-js/is-negative-zero/commit/128d9bd4c12385fb5e478ac3dd3138fa4360a777) 76 | 77 | ## [v2.0.0](https://github.com/inspect-js/is-negative-zero/compare/v1.0.0...v2.0.0) - 2015-07-24 78 | 79 | ### Commits 80 | 81 | - Update `tape`, `eslint`; use my personal shared `eslint` config. [`648d002`](https://github.com/inspect-js/is-negative-zero/commit/648d0029b177886428a11b07307f233ae2d3175b) 82 | - Add `npm run eslint` [`5a52d80`](https://github.com/inspect-js/is-negative-zero/commit/5a52d80ab052e377044b9b181991a32afaaa3090) 83 | - Using my standard jscs.json file [`5a667d9`](https://github.com/inspect-js/is-negative-zero/commit/5a667d9f8b7402ca3bd134080cd4435b5c7f1462) 84 | - Adding `npm run lint` [`9a85ed9`](https://github.com/inspect-js/is-negative-zero/commit/9a85ed934da65d8733a38bf6ad3c89fd62115194) 85 | - Update `tape`, `covert`, `jscs` [`c6cd3a6`](https://github.com/inspect-js/is-negative-zero/commit/c6cd3a64ea5b98100e10537549f50a9eeadc30ec) 86 | - Update `eslint` [`e9c9b6e`](https://github.com/inspect-js/is-negative-zero/commit/e9c9b6e9623f021b7f3ae4091bf9ea2571ab02b4) 87 | - Test on latest `io.js` [`2f7c8a9`](https://github.com/inspect-js/is-negative-zero/commit/2f7c8a9d174066400c072841d7bcf02cf90f8ebf) 88 | - Adding license and downloads badges [`717087a`](https://github.com/inspect-js/is-negative-zero/commit/717087a013b4cfc9dc7847d3d4a64faf19341be4) 89 | - Remove Number type coercion. [`481295d`](https://github.com/inspect-js/is-negative-zero/commit/481295dbd09dbf81d196dc77382f1b92f534de3f) 90 | - Test up to `io.js` `v2.1` [`139a84a`](https://github.com/inspect-js/is-negative-zero/commit/139a84a3dbdec29682044c6e7ac884a7382ae6e1) 91 | - Update `eslint` [`2f5fbfb`](https://github.com/inspect-js/is-negative-zero/commit/2f5fbfbc436ccd8676fc36fcd9f0edcdda33a1e7) 92 | - Update `eslint` [`53cb4c5`](https://github.com/inspect-js/is-negative-zero/commit/53cb4c5eccecdf2d874e78e5c38cca762ed76a9d) 93 | - Test on `io.js` `v2.2` [`98a1824`](https://github.com/inspect-js/is-negative-zero/commit/98a1824c86366f8a03cf303f46acecd67409f94b) 94 | - All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`. [`772d6cd`](https://github.com/inspect-js/is-negative-zero/commit/772d6cdf397e6fc1b26e5ed5f279d07a5ead6df8) 95 | - Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures. [`3e6147e`](https://github.com/inspect-js/is-negative-zero/commit/3e6147ebb5ecdfda4a2bffa441572fe017c7bb73) 96 | - Use SVG badges instead of PNG [`d986cb4`](https://github.com/inspect-js/is-negative-zero/commit/d986cb450e5bd4f373041255b69e18f47c252a1e) 97 | - Update `tape`, `jscs` [`9f9d7e7`](https://github.com/inspect-js/is-negative-zero/commit/9f9d7e751bcf4ceeed8e36e75e31d29c76326b3f) 98 | - Update `jscs` [`079eaf6`](https://github.com/inspect-js/is-negative-zero/commit/079eaf699d53e7e32c54e5233259a00f5f494d9a) 99 | - Update `tape`, `jscs` [`cffe3fc`](https://github.com/inspect-js/is-negative-zero/commit/cffe3fc17c6bfaa6996bf7402446b160631a04b3) 100 | - Update `tape`, `jscs` [`3a16616`](https://github.com/inspect-js/is-negative-zero/commit/3a166165ae8770d59c296794d28547379cebec58) 101 | - Use consistent quotes [`9509a81`](https://github.com/inspect-js/is-negative-zero/commit/9509a8110027b12c5762ba48d03b649a921847d5) 102 | - Test on `io.js` `v2.4` [`a9150a3`](https://github.com/inspect-js/is-negative-zero/commit/a9150a3397db339d992e9e4e6ddb52d1237fd617) 103 | - Test on `io.js` `v2.3` [`36d7acf`](https://github.com/inspect-js/is-negative-zero/commit/36d7acf5bb9193a2b35585e2c49ae8be9f45a55e) 104 | - Lock covert to v1.0.0. [`29d8917`](https://github.com/inspect-js/is-negative-zero/commit/29d89171c3aad69ace372edbf641ec3a5468c760) 105 | - Updating jscs [`fe09c8a`](https://github.com/inspect-js/is-negative-zero/commit/fe09c8a6d16c637ecd83a9a8a7f6192faef0754a) 106 | - Updating jscs [`5877bc7`](https://github.com/inspect-js/is-negative-zero/commit/5877bc7c2ed44c1ecc5d31e1c484c523450722d8) 107 | - Running linter as part of tests [`9e77756`](https://github.com/inspect-js/is-negative-zero/commit/9e777563905f511d915ec7257e2637811b911bd6) 108 | - Updating covert [`520a695`](https://github.com/inspect-js/is-negative-zero/commit/520a695164465b88c76860a638baafd4192bce5c) 109 | 110 | ## [v1.0.0](https://github.com/inspect-js/is-negative-zero/compare/v0.1.1...v1.0.0) - 2014-08-08 111 | 112 | ### Commits 113 | 114 | - Updating tape [`31d1942`](https://github.com/inspect-js/is-negative-zero/commit/31d19422ecd9d453677851a9d5a8d9372a16fb39) 115 | - Updating tape [`e7143bf`](https://github.com/inspect-js/is-negative-zero/commit/e7143bf3b67d8881b1b6ee0444637647d7bb1d2b) 116 | 117 | ## [v0.1.1](https://github.com/inspect-js/is-negative-zero/compare/v0.1.0...v0.1.1) - 2014-05-13 118 | 119 | ### Merged 120 | 121 | - Simplify code [`#1`](https://github.com/inspect-js/is-negative-zero/pull/1) 122 | 123 | ### Commits 124 | 125 | - Adding a trailing newline [`61fb37f`](https://github.com/inspect-js/is-negative-zero/commit/61fb37f677e871cca53d9309e765d808ddddfd5a) 126 | 127 | ## [v0.1.0](https://github.com/inspect-js/is-negative-zero/compare/v0.0.0...v0.1.0) - 2014-05-13 128 | 129 | ### Commits 130 | 131 | - Make sure old and unstable nodes don't break Travis [`f627215`](https://github.com/inspect-js/is-negative-zero/commit/f627215527a95dc1ca014600650e00f15fe122c5) 132 | - Updating deps [`b502f48`](https://github.com/inspect-js/is-negative-zero/commit/b502f48e807d7671cb07e2ca247ae2daa62e4165) 133 | - Oops, negative numbers were negative zero! [`746cb97`](https://github.com/inspect-js/is-negative-zero/commit/746cb975d82c0fa0c5058e8e031807f9afcfd6db) 134 | - Updating covert [`99ef4ed`](https://github.com/inspect-js/is-negative-zero/commit/99ef4ed97d2f76f2a5afbef029bf794f1b5bcffa) 135 | - Updating tape [`ee9cfc2`](https://github.com/inspect-js/is-negative-zero/commit/ee9cfc2fd0039bdb65b6493ce0b8e47d18aa17cd) 136 | - Testing on node 0.6 again [`6a9bf0a`](https://github.com/inspect-js/is-negative-zero/commit/6a9bf0a09e210cca09c7a8a225d08ef1e6789b5a) 137 | 138 | ## v0.0.0 - 2014-01-19 139 | 140 | ### Commits 141 | 142 | - package.json [`8411d92`](https://github.com/inspect-js/is-negative-zero/commit/8411d92ec787fd522a1b5e65154ae88e9024a23f) 143 | - read me [`5c8bf3c`](https://github.com/inspect-js/is-negative-zero/commit/5c8bf3ce4867dbf2997ef01ea6b712aa294ec959) 144 | - Initial commit [`c06f7dc`](https://github.com/inspect-js/is-negative-zero/commit/c06f7dcf926f5b35ba678787a0f16cdd7b544054) 145 | - Tests. [`5c554d4`](https://github.com/inspect-js/is-negative-zero/commit/5c554d405bfb323a7413fde395d8dc39c5316356) 146 | - Travis CI [`334d000`](https://github.com/inspect-js/is-negative-zero/commit/334d000941fc926493cc7dbdb4e5f7ae481a311b) 147 | - Implementation. [`4ef4491`](https://github.com/inspect-js/is-negative-zero/commit/4ef449189c36d471d283e40aa20a8ebfa4985882) 148 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Jordan Harband 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # is-negative-zero [![Version Badge][npm-version-svg]][package-url] 2 | 3 | [![github actions][actions-image]][actions-url] 4 | [![coverage][codecov-image]][codecov-url] 5 | [![dependency status][deps-svg]][deps-url] 6 | [![dev dependency status][dev-deps-svg]][dev-deps-url] 7 | [![License][license-image]][license-url] 8 | [![Downloads][downloads-image]][downloads-url] 9 | 10 | [![npm badge][npm-badge-png]][package-url] 11 | 12 | Is this value negative zero? === will lie to you. 13 | 14 | ## Example 15 | 16 | ```js 17 | var isNegativeZero = require('is-negative-zero'); 18 | var assert = require('assert'); 19 | 20 | assert.notOk(isNegativeZero(undefined)); 21 | assert.notOk(isNegativeZero(null)); 22 | assert.notOk(isNegativeZero(false)); 23 | assert.notOk(isNegativeZero(true)); 24 | assert.notOk(isNegativeZero(0)); 25 | assert.notOk(isNegativeZero(42)); 26 | assert.notOk(isNegativeZero(Infinity)); 27 | assert.notOk(isNegativeZero(-Infinity)); 28 | assert.notOk(isNegativeZero(NaN)); 29 | assert.notOk(isNegativeZero('foo')); 30 | assert.notOk(isNegativeZero(function () {})); 31 | assert.notOk(isNegativeZero([])); 32 | assert.notOk(isNegativeZero({})); 33 | 34 | assert.ok(isNegativeZero(-0)); 35 | ``` 36 | 37 | ## Tests 38 | Simply clone the repo, `npm install`, and run `npm test` 39 | 40 | [package-url]: https://npmjs.org/package/is-negative-zero 41 | [npm-version-svg]: https://versionbadg.es/inspect-js/is-negative-zero.svg 42 | [deps-svg]: https://david-dm.org/inspect-js/is-negative-zero.svg 43 | [deps-url]: https://david-dm.org/inspect-js/is-negative-zero 44 | [dev-deps-svg]: https://david-dm.org/inspect-js/is-negative-zero/dev-status.svg 45 | [dev-deps-url]: https://david-dm.org/inspect-js/is-negative-zero#info=devDependencies 46 | [npm-badge-png]: https://nodei.co/npm/is-negative-zero.png?downloads=true&stars=true 47 | [license-image]: https://img.shields.io/npm/l/is-negative-zero.svg 48 | [license-url]: LICENSE 49 | [downloads-image]: https://img.shields.io/npm/dm/is-negative-zero.svg 50 | [downloads-url]: https://npm-stat.com/charts.html?package=is-negative-zero 51 | [codecov-image]: https://codecov.io/gh/inspect-js/is-negative-zero/branch/main/graphs/badge.svg 52 | [codecov-url]: https://app.codecov.io/gh/inspect-js/is-negative-zero/ 53 | [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-negative-zero 54 | [actions-url]: https://github.com/inspect-js/is-negative-zero/actions 55 | -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | declare function isNegativeZero(number: unknown): number is -0; 2 | 3 | export = isNegativeZero; -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** @type {import('.')} */ 4 | module.exports = function isNegativeZero(number) { 5 | return number === 0 && (1 / number) === -Infinity; 6 | }; 7 | 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "is-negative-zero", 3 | "version": "2.0.3", 4 | "description": "Is this value negative zero? === will lie to you", 5 | "author": "Jordan Harband ", 6 | "funding": { 7 | "url": "https://github.com/sponsors/ljharb" 8 | }, 9 | "license": "MIT", 10 | "main": "index.js", 11 | "types": "./index.d.ts", 12 | "sideEffects": false, 13 | "scripts": { 14 | "prepack": "npmignore --auto --commentLines=autogenerated", 15 | "prepublishOnly": "safe-publish-latest", 16 | "prepublish": "not-in-publish || npm run prepublishOnly", 17 | "pretest": "npm run lint", 18 | "test": "npm run tests-only", 19 | "tests-only": "nyc tape 'test/**/*.js'", 20 | "posttest": "npx npm@'>= 10.2' audit --production", 21 | "lint": "eslint --ext=js,mjs .", 22 | "postlint": "tsc -p .", 23 | "version": "auto-changelog && git add CHANGELOG.md", 24 | "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" 25 | }, 26 | "repository": { 27 | "type": "git", 28 | "url": "git://github.com/inspect-js/is-negative-zero.git" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/inspect-js/is-negative-zero/issues" 32 | }, 33 | "homepage": "https://github.com/inspect-js/is-negative-zero", 34 | "keywords": [ 35 | "is", 36 | "negative", 37 | "zero", 38 | "negative zero", 39 | "number", 40 | "positive", 41 | "0", 42 | "-0" 43 | ], 44 | "devDependencies": { 45 | "@arethetypeswrong/cli": "^0.17.2", 46 | "@ljharb/eslint-config": "^21.1.1", 47 | "@ljharb/tsconfig": "^0.2.2", 48 | "@types/tape": "^5.8.0", 49 | "auto-changelog": "^2.5.0", 50 | "encoding": "^0.1.13", 51 | "eslint": "=8.8.0", 52 | "in-publish": "^2.0.1", 53 | "npmignore": "^0.3.1", 54 | "nyc": "^10.3.2", 55 | "safe-publish-latest": "^2.0.0", 56 | "tape": "^5.9.0", 57 | "typescript": "next" 58 | }, 59 | "testling": { 60 | "files": "test/index.js", 61 | "browsers": [ 62 | "iexplore/6.0..latest", 63 | "firefox/3.0..6.0", 64 | "firefox/15.0..latest", 65 | "firefox/nightly", 66 | "chrome/4.0..10.0", 67 | "chrome/20.0..latest", 68 | "chrome/canary", 69 | "opera/10.0..12.0", 70 | "opera/15.0..latest", 71 | "opera/next", 72 | "safari/4.0..latest", 73 | "ipad/6.0..latest", 74 | "iphone/6.0..latest", 75 | "android-browser/4.2" 76 | ] 77 | }, 78 | "engines": { 79 | "node": ">= 0.4" 80 | }, 81 | "auto-changelog": { 82 | "output": "CHANGELOG.md", 83 | "template": "keepachangelog", 84 | "unreleased": false, 85 | "commitLimit": false, 86 | "backfillLimit": false, 87 | "hideCredit": true 88 | }, 89 | "publishConfig": { 90 | "ignore": [ 91 | ".github/workflows" 92 | ] 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var test = require('tape'); 4 | var isNegativeZero = require('../'); 5 | 6 | test('not negative zero', function (t) { 7 | // @ts-expect-error 8 | t.notOk(isNegativeZero(), 'undefined is not negative zero'); 9 | t.notOk(isNegativeZero(null), 'null is not negative zero'); 10 | t.notOk(isNegativeZero(false), 'false is not negative zero'); 11 | t.notOk(isNegativeZero(true), 'true is not negative zero'); 12 | t.notOk(isNegativeZero(0), 'positive zero is not negative zero'); 13 | t.notOk(isNegativeZero(Infinity), 'Infinity is not negative zero'); 14 | t.notOk(isNegativeZero(-Infinity), '-Infinity is not negative zero'); 15 | t.notOk(isNegativeZero(NaN), 'NaN is not negative zero'); 16 | t.notOk(isNegativeZero('foo'), 'string is not negative zero'); 17 | t.notOk(isNegativeZero([]), 'array is not negative zero'); 18 | t.notOk(isNegativeZero({}), 'object is not negative zero'); 19 | t.notOk(isNegativeZero(function () {}), 'function is not negative zero'); 20 | t.notOk(isNegativeZero(-1), '-1 is not negative zero'); 21 | 22 | t.end(); 23 | }); 24 | 25 | test('negative zero', function (t) { 26 | t.ok(isNegativeZero(-0), 'negative zero is negative zero'); 27 | t.end(); 28 | }); 29 | 30 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@ljharb/tsconfig", 3 | "exclude": [ 4 | "coverage", 5 | ], 6 | } 7 | --------------------------------------------------------------------------------