useful-simple-functions
v1.0.20
Published
Useful simple functions.
Downloads
10
Maintainers
Readme
useful-simple-functions
Useful simple functions.
Installing
Using npm:
npm i useful-simple-functions
Using bower:
bower install useful-simple-functions
Using yarn:
yarn add useful-simple-functions
Example
note: CommonJS usage
const useful = require('useful-simple-functions');
useful.capitalize('text text');
// TEXT TEXT
useful.sanitize('A@B#C$1%2&3');
// ABC123
Methods
sanitize
const useful = require('useful-simple-functions');
useful.sanitize('A@B#C$1%2&3');
// ABC123
capitalize
const useful = require('useful-simple-functions');
useful.capitalize('text text');
// TEXT TEXT
sanitizeAndCapitalize
const useful = require('useful-simple-functions');
useful.sanitizeAndCapitalize('a@b#c$1%2&3');
// ABC123
capitalizeFirst
const useful = require('useful-simple-functions');
useful.capitalizeFirst('any text');
// Any text
isNull
const useful = require('useful-simple-functions');
useful.isNull('any text');
// false
useful.isNull(null);
// true
isNotNull
const useful = require('useful-simple-functions');
useful.isNotNull('any text');
// true
useful.isNotNull(null);
// false
isEmpty
const useful = require('useful-simple-functions');
useful.isEmpty('any text');
// false
useful.isEmpty('');
// true
useful.isEmpty({});
// true
useful.isEmpty([]);
// true
useful.isEmpty(new Set());
// true
useful.isEmpty(new Map());
// true
isNotEmpty
const useful = require('useful-simple-functions');
useful.isNotEmpty('any text');
// true
useful.isNotEmpty('');
// false
useful.isNotEmpty({});
// false
useful.isNotEmpty([]);
// false
useful.isNotEmpty(new Set());
// false
useful.isNotEmpty(new Map());
// false
isBlank
const useful = require('useful-simple-functions');
useful.isBlank('any text');
// false
useful.isBlank(' ');
// true
isNumber
const useful = require('useful-simple-functions');
useful.isNumber('1.0');
// true
useful.isNumber(1.0);
// true
useful.isNumber(.0);
// true
useful.isNumber(0);
// true
useful.isNumber(-1.0);
// true
useful.isNumber('any text');
// false
useful.isNumber(' ');
// false
useful.isNumber('1,0');
// false
useful.isNumber(',0');
// false
isCpf
const useful = require('useful-simple-functions');
useful.isCpf('123.456.789-09');
// true
useful.isCpf('999.999.999-99');
// false
isCnpj
const useful = require('useful-simple-functions');
useful.isCnpj('52.851.132/0001-20');
// true
useful.isCnpj('00.000.000/0000-00');
// false
isCpfCnpj
const useful = require('useful-simple-functions');
useful.isCpfCnpj('123.456.789-09');
// true
useful.isCpfCnpj('52.851.132/0001-20');
// true
useful.isCpfCnpj('999.999.999-99');
// false
useful.isCpfCnpj('00.000.000/0000-00');
// false