1.0.1 • Published 6 years ago

contains-number v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

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
1.0.1

6 years ago

1.0.0

6 years ago