{"id":23297705,"url":"https://github.com/drag13/isnumberstrict","last_synced_at":"2025-07-06T04:36:28.638Z","repository":{"id":42503589,"uuid":"141154044","full_name":"Drag13/IsNumberStrict","owner":"Drag13","description":"Checks if JavaScript variable is a number. Strings are not allowed.","archived":false,"fork":false,"pushed_at":"2023-01-27T08:44:33.000Z","size":1102,"stargazers_count":11,"open_issues_count":3,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-31T19:10:15.686Z","etag":null,"topics":["isnumber","javascript","library","npm-package","number","numbers","typecheck","typechecking"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Drag13.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-16T14:58:53.000Z","updated_at":"2023-02-08T14:19:35.000Z","dependencies_parsed_at":"2023-02-15T07:05:32.415Z","dependency_job_id":null,"html_url":"https://github.com/Drag13/IsNumberStrict","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drag13%2FIsNumberStrict","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drag13%2FIsNumberStrict/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drag13%2FIsNumberStrict/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drag13%2FIsNumberStrict/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Drag13","download_url":"https://codeload.github.com/Drag13/IsNumberStrict/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230547634,"owners_count":18243227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["isnumber","javascript","library","npm-package","number","numbers","typecheck","typechecking"],"created_at":"2024-12-20T07:18:48.478Z","updated_at":"2024-12-20T07:18:49.081Z","avatar_url":"https://github.com/Drag13.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![StandsWithUkraine](https://github.com/Drag13/drag13.github.io/blob/development/swu.PNG)\n](https://savelife.in.ua/en/donate/)\n\n# IsNumberStrict - check if something is a number\n\n[![Weekly loads](https://img.shields.io/npm/dm/is-number-strict)](https://img.shields.io/npm/dm/is-number-strict)\n[![Minzipped size](https://img.shields.io/bundlephobia/minzip/is-number-strict)](https://img.shields.io/bundlephobia/minzip/is-number-strict)\n[![Build Status](https://travis-ci.org/Drag13/IsNumberStrict.svg?branch=master)](https://travis-ci.org/Drag13/IsNumberStrict)\n[![codecov](https://codecov.io/gh/Drag13/isnumberstrict/branch/master/graph/badge.svg)](https://codecov.io/gh/Drag13/isnumberstrict)\n[![TypeSCript](https://img.shields.io/badge/TypeScript-Ready-brightgreen.svg)](https://github.com/Drag13/IsNumberStrict)\n[![GitHub license](https://img.shields.io/github/license/Drag13/WhenDo.svg)](https://github.com/Drag13/IsNumberStrict/blob/master/LICENSE)\n\nDesigned to strictly check if the value is a number. Works with Number objects, hex, and so on. Returns `false` for `string` and other not numbers like `{}`, `undefined`, `NaN`\n\n## Install\n\n```cmd\nnpm i is-number-strict\n```\n\n## Usage\n\nJavaScript with require syntax\n\n```javascript\nconst isNumber = require('is-number-strict').default;\n\nconsole.assert(isNumber(5));\nconsole.assert(!isNumber('5'));\n```\n\nJavaScript with import syntax\n\n```javascript\nimport isNumber from \"is-number-strict\";\n\nconsole.assert(isNumber(5));\nconsole.assert(!isNumber('5'));\n```\n\n## What problem it solves\n\nThis tiny lib tries to make type assertion little bit more predictable and remove NaN from your calculations.\n\n```javascript\ntypeof new Number(42);\n\u003e 'object'\n```\n\nBut it is working as good old number\n\n```javascript\nnew Number(5) * new Number(6);\n\u003e 30\n```\n\nSo:\n\n```javascript\nisNumberStrict(new Number(5));\n\u003e true\n```\n\nBut:\n\n```javascript\nisNumberStrict('5');\n\u003e false\n```\n\nAnd\n\n```javascript\nisNumberStrict(NaN);\n\u003e false\n```\n\n\u003e Why didn't you treat '5' as a number? '5' + 5 = 10!\nYes, but 5 + '5' = '55' and 5 * '5' = NaN. I don't want to see NaN or '55' in my calculations.\n\nSo if you want to have more predictable type checking - check my tests and welcome!\n\n## Some wired cases\n\n\u003e Why do you treat new Number([]) as a number?\n\nBecause JS will evaluate it to 0, and 0 is number.\n\n\u003e Why do you treat new number({}) as not a number?\n\nBecause JS will evaluate it to  NaN and NaN is not a number according to my purposes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrag13%2Fisnumberstrict","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrag13%2Fisnumberstrict","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrag13%2Fisnumberstrict/lists"}