contains-number

1.0.1 • Public • Published

Contains Number

Checks if a string or an array contains a number.

Installation

npm install contains-number

Usage

Create a global variable.

const check = require('contains-number');


Check if a string contains a number

To check if a string contains a number call the following function with the string as parameter.

let txt = 'This is the 1st test!';
let contains = check.stringContainsNumber(txt);
console.log(contains);

Output:
The output is true if the string contains a number or false if the string does not contain a number.

true


Check if an array contains a number

To check if an array contains a number call the following function with the string as parameter.

let arr = [1, 'asfddf'];
let contains = check.arrayContainsNumber(arr);
console.log(contains);

Output:
The output is true if the array contains a number or false if the array does not contain a number.

true

Package Sidebar

Install

npm i contains-number

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

1.66 kB

Total Files

3

Last publish

Collaborators

  • manuelwiltz