2.0.1 • Published 2 years ago

is-decimal v2.0.1

Weekly downloads
4,853,674
License
MIT
Repository
github
Last release
2 years ago

is-decimal

Build Coverage Downloads Size

Check if a character is a decimal.

Contents

What is this?

This is a function that checks if a given character is an ASCII decimal.

When should I use this?

Not often, as it’s relatively simple to do yourself. This package exists because it’s needed in several related packages, at which point it becomes useful to defer to one shared function.

Install

This package is ESM only. In Node.js (version 12.20+, 14.14+, or 16.0+), install with npm:

npm install is-decimal

In Deno with Skypack:

import {isDecimal} from 'https://cdn.skypack.dev/is-decimal@2?dts'

In browsers with Skypack:

<script type="module">
  import {isDecimal} from 'https://cdn.skypack.dev/is-decimal@2?min'
</script>

Use

import {isDecimal} from 'is-decimal'

isDecimal('0') // => true
isDecimal('9') // => true
isDecimal('a') // => false
isDecimal('💩') // => false

API

This package exports the following identifiers: isDecimal. There is no default export.

isDecimal(character|code)

Check whether the given character code (number), or the character code at the first position (string), is decimal.

Types

This package is fully typed with TypeScript.

Compatibility

This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 12.20+, 14.14+, and 16.0+. It also works in Deno and modern browsers.

Security

This package is safe.

Related

Contribute

Yes please! See How to Contribute to Open Source.

License

MIT © Titus Wormer

parse-entitiesis-alphanumerical@texttree/demo-bsa-reference-rclcogoportutils@infinitebrahmanuniverse/nolb-is-d@saaspe/componentsopea-bootstraap@everything-registry/sub-chunk-1932@314oner_npm/universal-components-librarydesign-system-fitbank-450sequelcomponentdfeuk-frontenddfeuk-frontend-manualreact-native-video-typoremark-parse-no-trimremark-github-parse-linkeasyplayer-my@backhq/mrkdwn-parse@besync/parse-entities-webworker@brodybits/remark-parseckeditor5-build-classic-ticketckeditor5-build-classic-v-edit@blkmarketco/components-library@cute-apocalypse/react-treeasync-computed-vue3react-form-component-library@ak48/starcoinbase-editorbcp-47fn-lib-examplesuperset-plugin-chart-hello-world2svelte-component-libtldrawligninqjc2-blockzzzxxxyyy321123@batbayar/superset-plugin-chart-hello-world@vitali_shcherbina/styled-libappcharge-checkoutappcharge-checkout-reactjs-sdk@yubing744/starcoin@superset-plugins-sm/superset-plugin-chart-hello-worldinstall-isu-librarygoogle-remake@mapbox/jsxtreme-markdown@lego-js/tests@hawkingnetwork/react-native-tab-view@enkidevs/remark-stringify@podlubnaja/ui-kitparvan_componentsparvan_reactjs_components@poscredit/plugin-chart-boris@mizchi/remark-parsenpm-all-packages@oriduk/ckeditor5-rebuild-musicanote@oriduk/ckeditor5-rebuild-oridukopea-bootstrap@fabwcie/ckeditor5-preview@sbaldwin24/stylelint-config@shedali/remark-stringify@skeetboothppq/component-library@silver0542/directus-extension-cma-components-editor@shivarajapple/first-library@starcoin-org/starcoin@starcoin/starcoin
2.0.1

2 years ago

2.0.0

3 years ago

1.0.4

4 years ago

1.0.3

5 years ago

1.0.2

6 years ago

1.0.1

7 years ago

1.0.0

8 years ago