Utility function to remove non-numeric characters of input.
npm install num-only!NPM Latest Version
!Bundle Size
!Downloads Count
!Test Status
!Last Update Date
!Project License
JavaScript package with a function to stringify and remove non-numeric characters of items.
!Chrome | !Firefox | !Safari | !Opera | !Edge | !IE |
--- | --- | --- | --- | --- | --- |
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
``bashusing NPM
$ npm install --save num-only
Import
`js
// ES Modules
import numOnly from 'num-only'// Common JS
const numOnly = require('num-only')
`or import it through your HTML file, using CDN:
`html
`Usage
`js
numOnly('12345') // returns '12345'
numOnly('abc123') // returns '123'
numOnly(['a', 'b', 'c', 1, 2, 3]) // returns '123'
numOnly(true) // returns ''
numOnly(() => 5 + 3) // returns '53'
``