@doutor.space/only-numbers
v1.0.1
Published
[![Maintainability](https://api.codeclimate.com/v1/badges/25b42c67eddaaf275d43/maintainability)](https://codeclimate.com/repos/5e458bb5735c7c01a101d6a7/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/25b42c67eddaaf275d43/test_cove
Downloads
10
Readme
@doutor.space/only-numbers
Remove todos os caracteres não numerais de uma string.
Use uma das opções:
// ES5
const onlyNumbers = require('@doutor.space/only-numbers');
// ES6
import onlyNumbers from '@doutor.space/only-numbers';
const result = onlyNumbers(12312312312);
console.log(result); /// 12312312312
const result = onlyNumbers('1231z312x12');
console.log(result); /// 123131212
const result = onlyNumbers('abc');
console.log(result); /// ''
const result = onlyNumbers('abc', true);
console.log(result); /// NaN