@dh-utils/common v0.4.13
@dh-utils/common
Readme in Czech (Readme v Češtině)
The library contains basic functions over various primitive values, data types and data structures.
Description
The basic primitive values, data types and data structures we work with will be loosely referred in this document as types of values, although this does not exactly correspond to the exact JS specification.
These JS constructs are meant here as types of values in this library: Array, Boolean, Date, Function, null, Number, Object, RegExp, String, Symbol, undefined.
Basic functions in this library are divided into:
- general functions = work for all types of values
- local functions = work for a specific value type
General functions
If you work with variables with different or general value types, use general functions.
Usage general functions:
import { compare, utilsCommon } from '@dh-utils/common';
compare(0,0); // 0
compare(false, 0); // -1
// or
utilsCommon.compare(0,0); // 0
utilsCommon.compare(false, 0); // -1
List of general functions: compare, compareReferences, copy, equal, isArray, isBoolean, isDate, isDefined, isEmpty, isFunction, isNotArray, isNotDefined, isNotEmpty, isNotNull, isNumber, isNull, isObject, isPrimitive, isRegExp, isString, isSymbol, isUndefined, findOutTheType, notEqual
Local functions by type
If you are working with variables with a specific value type, use local functions by type.
Usage local functions by type:
import { utilsArray } from '@dh-utils/common';
utilsArray.compare([1,2,3],[1,2,3]) // 0
The basic local functions are 4: compare, copy, equal, is
Local function compare(a,b)
Local function compare (a,b) = compare value type. Returns the values: -1 (a <b) | 0 (a = b) | 1 (a < b).
Usage local function compare(a,b):
import { utilsString } from '@dh-utils/common';
utilsString.compare("ABC","ABC"); // 0
utilsString.compare("ABC","ZXY"); // -1
Local function copy(a)
Local function copy(a) = creates a copy. In the case of a complex data structure, it is a deep copy.
Usage locale function copy:
import { utilsArray } from '@dh-utils/common';
utilsArray.copy([1,2,3]); // [1,2,3]
Local function equal(a,b)
Local function equal (a,b) = compares the value type. Returns values true or false.
Usage locale function copy:
import { utilsString } from '@dh-utils/common';
utilsString.equal("ABC","ZXY"); // false
Local function is(a)
Local function is (a) = check if the given variable is of a given value type? Returns values true or false.
Usage locale function is:
import { utilsString } from '@dh-utils/common';
utilsString.is("ABC"); // true
utilsString.is(0); // false
List local functions by type:
- Array : compare, copy, equal, is, isEmpty, isNotEmpty
- Boolean : compare, copy, equal, is
- Date : compare, copy, equal, is
- Function : compare, copy, equal, is
- Null : compare, copy, equal, is
- Number : compare, copy, equal, is
- Object : compare, copy, equal, is, isEmpty, isNotEmpty
- RegExp : compare, copy, equal, is
- String : compare, copy, equal, is, isEmpty, isNotEmpty, isNumeric
- Symbol : compare, copy, equal, is
- Undefined : compare, copy, equal, is
Working with specific value types
In exceptional cases, you will want to use basic functions over your specially created types. Yes, it is possible. These general functions compare, copy, equal, is also have a third parameter of the function, with which you can adjust over which types of values you want to perform the basic functionality.
Example: We will have special data structures / special types of values "Car" and "Airplane". These types of values differ by the "model" attribute. The special value type "Car" can therefore have the model = "Honda" or "Suzuki". Therefore, the special value type "Airplane" can have model = "Mig" or "F16":
import { compare } from "@dh-utils/common";
// functions over special data structure (value types)
const typeValueAirplane = {
_fce: "Airplane",
compare: function (a, b) {
return a.model.localeCompare(b.model);
},
copy: function(a){/* zde bude fce copy */},
equal: function(a, b){return a.model.toString() === b.model.toString();},
is: function (a) {
return a.type === "airplane";
},
};
const typeValueCar = {
_fce: "Car",
compare: function (a, b) {
return a.model.localeCompare(b.model);
},
copy: function(a){/* zde bude fce copy */},
equal: function(a, b){return a.model.toString() === b.model.toString();},
is: function (a) {
return a.type === "car";
},
};
// special data structure classes
const ClassAirplane = class Airplane {
constructor(model) {
this.type = "airplane";
this.model = model || "empty";
}
};
const ClassCar = class Car {
constructor(model) {
this.type = "car";
this.model = model || "empty";
}
};
// defining objects
const airplaneIljusin = new ClassAirplane("Iljusin");
const carSuzuki = new ClassCar("Suzuki");
const carHonda = new ClassCar("Honda");
const carHonda2 = new ClassCar("Honda");
// defining a list of a specific data structure (type of values)
const listTypeValues = [typeValueAirplane, typeValueCar];
// specific work with functions
compare(airplaneIljusin, carSuzuki, listTypeValues); // -1
compare(carSuzuki, carHonda, listTypeValues); // -1
compare(carHonda, carHonda2, listTypeValues); // 0
API - General functions
⌂ compare(any,any,array) : number
- description : comparison of two values (any)
- return type : {number} -1|0|1
- parametr a : {any}
- parametr b : {any}
- parametr c : {array} sheet type values; specific use
usage :
import { compare, utilsCommon } from '@dh-utils/common';
compare(0,0); // 0
// or
utilsCommon.compare(0,0); // 0
⌂ compareReferences(any,any) : number
- description : comparison of two references
- return type : {number} -1|0|1
- parametr a : {any}
- parametr b : {any}
usage :
import { compareReferences, utilsCommon } from '@dh-utils/common';
compareReferences(0,0); // 0
// or
utilsCommon.compareReferences(0,0); // 0
const a = {}, b = a;
compareReferences(a,b); // 0
const a = {}, b = {}
compareReferences(a,b); // 1
⌂ copy(any) : any
- description : deep copy
- return type : {any}
- parametr a : {any}
usage :
import { copy, utilsCommon } from '@dh-utils/common';
copy({a:"a",b:"b"}); // {a:"a",b:"b"}
// or
utilsCommon.copy({a:"a",b:"b"}); // {a:"a",b:"b"}
copy([1,2,3,4]); // [1,2,3,4]
⌂ equal(any,any) : boolean
- description : equal
- return type : {boolean} true|false
- parametr a : {any}
- parametr b : {any}
usage :
import { copy, utilsCommon } from '@dh-utils/common';
equal(0,0); // true
// or
utilsCommon.equal(0,0); // true
equal(3,3); // true
equal([0,1,2,3,[0,1,2]],[0,1,2,3,[0,1,2]]); // true
equal([0,1,2,3,[0,1,2]],[0,1,2,3,[0,2,1]]); // false
⌂ isArray(any) : boolean
- description : is the value of the array type?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { copy, utilsCommon } from '@dh-utils/common';
isArray(0); // false
// or
utilsCommon.isArray(0); // false
isArray([1,2,3,4]); // true
isArray(3); // false
⌂ isBoolean(any) : boolean
- description : is the value of the array boolean?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { copy, utilsCommon } from '@dh-utils/common';
isBoolean(0); // false
// or
utilsCommon.isBoolean(0); // false
isBoolean(true); // true
isBoolean(false); // true
isBoolean([1,2,3,4]); // false
⌂ isDate(any) : boolean
- description : is the value of the date type?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { copy, utilsCommon } from '@dh-utils/common';
isDate(0); // false
// or
utilsCommon.isDate(0); // false
isDate(new Date()); // true
isDate(3); // false
⌂ isDefined(any) : boolean
- description : is the value defined?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { copy, utilsCommon } from '@dh-utils/common';
isDefined(0); // true
// or
utilsCommon.isDefined(0); // true
isDefined([1,2,3,4]); // true
isDefined(null); // false
isDefined(undefined); // false
⌂ isEmpty(any) : boolean
- description : is the value empty?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { isEmpty, utilsCommon } from '@dh-utils/common';
isEmpty(0); // true
// or
utilsCommon.isEmpty(0); // true
isEmpty(null); // true
isEmpty(undefined); // true
isEmpty([]); // true
isEmpty({}); // true
isEmpty(""); // true
isEmpty([1,2,3,4]); // false
isEmpty(42); // false
isEmpty("hellooo"); // false
⌂ isFunction(any) : boolean
- description : is the value of the function type?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { isFunction, utilsCommon } from '@dh-utils/common';
isFunction(0); // false
// or
utilsCommon.isFunction(0); // false
isFunction(()=>{}); // true
isFunction(3); // false
⌂ isNotArray(any) : boolean
- description : is not the value of the array type?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { isNotArray, utilsCommon } from '@dh-utils/common';
isNotArray(0); // false
// or
utilsCommon.isNotArray(0); // false
isNotArray([1,2,3,4]); // false
isNotArray({}); // true`
⌂ isNotDefined(any) : boolean
- description : is not value defined?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { isNotDefined, utilsCommon } from '@dh-utils/common';
isNotDefined(0); // false
// or
utilsCommon.isNotDefined(0); // false
isNotDefined([1,2,3,4]); // true
isNotDefined(null); // false
isNotDefined(undefined); // false
⌂ isNotEmpty(any) : boolean
- description : is not value empty?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { isNotEmpty, utilsCommon } from '@dh-utils/common';
isNotDefined(0); // false
// or
utilsCommon.isNotDefined(0); // false
isNotEmpty([1,2,3,4]); // true
isNotEmpty(42); // true
isNotEmpty("hellooo"); // true
isNotEmpty(null); // false
isNotEmpty(undefined); // false
isNotEmpty([]); // false
isNotEmpty({}); // false
isNotEmpty(""); // true
⌂ isNotNull(any) : boolean
- description : is not the value null?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { isNotNull, utilsCommon } from '@dh-utils/common';
isNotNull(0); // false
// or
utilsCommon.isNotNull(0); // false
isNotNull(null); // false
isNotNull(5); // true
⌂ isNumber(any) : boolean
- description : is a value of type number?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { isNumber, utilsCommon } from '@dh-utils/common';
isNumber(0); // true
// or
utilsCommon.isNumber(0); // true
isNumber("5"); // false
isNumber(5); // true
⌂ isNull(any) : boolean
- description : is a value null?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { isNull, utilsCommon } from '@dh-utils/common';
isNull(0); // false
// or
utilsCommon.isNull(0); // false
isNull(null); // true
isNull(5); // false
⌂ isObject(any) : boolean
- description : is a value of type object?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { isObject, utilsCommon } from '@dh-utils/common';
isObject(0); // false
// or
utilsCommon.isObject(0); // false
isObject({}); // true
isObject(3); // false
⌂ isPrimitive(any) : boolean
- description : is the value a primitive type?
- return type : boolean true|false
- parametr a : {any}
usage :
import { isPrimitive, utilsCommon } from '@dh-utils/common';
isPrimitive(0); // true
// or
utilsCommon.isPrimitive(0); // true
isPrimitive("Hellloo"); // true
isPrimitive(3); // true
isPrimitive({}); // false
⌂ isRegExp(any) : boolean
- description : is a value of type a regular expression?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { isRegExp, utilsCommon } from '@dh-utils/common';
isRegExp(0); // false
// or
utilsCommon.isRegExp(0); // false
isRegExp(/ab+c/); // true
⌂ isString(any) : boolean
- description : is a value of type string?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { isString, utilsCommon } from '@dh-utils/common';
isString("abc"); // true
// or
utilsCommon.isString("abc"); // true
isString("Hellloo"); // true
isString(3); // false
⌂ isSymbol(any) : boolean
- description : is a value of type symbol?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { isSymbol, utilsCommon } from '@dh-utils/common';
isSymbol(0); // false
// or
utilsCommon.isSymbol(0); // false
isSymbol(Symbol()); // true
isSymbol(Symbol(42)); // true
isSymbol(Symbol("foo")); // true
⌂ isUndefined(any) : boolean
- description : is a value of type undefined?
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { isUndefined, utilsCommon } from '@dh-utils/common';
isUndefined(0); // false
// or
utilsCommon.isUndefined(0); // false
const prom;
isUndefined(prom); // true
isUndefined(5); // false
⌂ findOutTheType(any) : string
- description : found type and returning the name as a string
- return type : {string} type as a string
- parametr a : {any}
použití :
import { findOutTheType, utilsCommon } from '@dh-utils/common';
findOutTheType(0); // "number"
findOutTheType("hellooo"); // "string"
// or
utilsCommon.findOutTheType(0); // "number"
utilsCommon.findOutTheType("hellooo"); // "string"
⌂ notEqual(any,any) : boolean
- description : not equal
- return type : {boolean} true|false
- parametr a : {any}
- parametr b : {any}
usage :
import { notEqual, utilsCommon } from '@dh-utils/common';
notEqual(0,0); // false
// or
utilsCommon.notEqual(0,0); // false
notEqual(3,3); // false
notEqual([0,1,2,3,[0,1,2]],[0,1,2,3,[0,1,2]]); // false
notEqual([0,1,2,3,[0,1,2]],[0,1,2,3,[0,2,1]]); // true
⌂ API - Local functions by type Array
⌂ NAME
- popis : constant NAME="array"
použití :
import { utilsArray } from '@dh-utils/common';
utilsArray.NAME // array
⌂ compare(array,array) : number
- popis : compare two arrays
- return type : {number} -1|0,1
- parametr a : {array}
- parametr b : {array}
usage :
import { utilsArray } from '@dh-utils/common';
utilsArray.compare([1,2,3],[1,2,3]) // 0
⌂ copy(array) : array
- popis : deep copy array
- return type : {array}
- parametr a : {array}
usage :
import { utilsArray } from '@dh-utils/common';
utilsArray.copy([1,2,3,4]); // [1,2,3,4]
⌂ equal(array,array) : boolean
- popis : equal two arrays
- return type : {boolean} false,true
- parametr a : {array}
- parametr b : {array}
usage :
import { utilsArray } from '@dh-utils/common';
utilsArray.equal([1,2,3,4],[1,2,3,4]); // true
utilsArray.equal([4,2,3,1],[1,2,3,4]); // false
⌂ is(any) : boolean
- popis : is a value of type array? same function as utilsCommon.isArray
- return type : {boolean}
- parametr a : {any}
usage :
import { utilsArray } from '@dh-utils/common';
utilsArray.is(5); // false
utilsArray.is([]); // true
⌂ isEmpty(array) : boolean
- popis : is an array empty?
- return type : {boolean}
- parametr a : {array}
usage :
import { utilsArray } from '@dh-utils/common';
utilsArray.isEmpty([1, 2, 3]); // false
utilsArray.isEmpty([]); // true
⌂ isNotEmpty(array) : boolean
- popis : is not an array empty?
- return type : {boolean}
- parametr a : {array}
usage :
import { utilsArray } from '@dh-utils/common';
utilsArray.isNotEmpty([1, 2, 3]); // false
utilsArray.isNotEmpty([]); // true
⌂ API - Local functions by type Boolean
⌂ NAME
- popis : constant NAME="boolean"
použití :
import { utilsBoolean } from '@dh-utils/common';
utilsBoolean.NAME // boolean
⌂ compare(boolean,boolean) : number
- popis : compare boolean
- return type : {number} -1|0|1
- parametr a : {boolean}
- parametr b : {boolean}
usage :
import { utilsBoolean } from '@dh-utils/common';
utilsBoolean.compare(true,true); // 0
utilsBoolean.compare(false,true); // -1
⌂ copy(boolean) : boolean
- popis : copy boolean
- return type : {boolean}
- parametr target : {boolean}
usage :
import { utilsBoolean } from '@dh-utils/common';
utilsBoolean.copy(true); // true
⌂ equal(boolean,boolean) : boolean
- popis : equal boolean
- return type : {boolean} false,true
- parametr a : {boolean}
- parametr b : {boolean}
usage :
import { utilsBoolean } from '@dh-utils/common';
utilsBoolean.equal(true,true); // true
utilsBoolean.equal(false,true); // false
⌂ is(any) : boolean
- popis : is a value of type boolean? same function as utilsCommon.isBoolean
- return type : {boolean}
- parametr a : {any}
usage :
import { utilsBoolean } from '@dh-utils/common';
utilsBoolean.is(true); // true
utilsBoolean.is(false); // false
⌂ API - Local functions by type Date
⌂ NAME
- popis : constant NAME="date"
použití :
import { utilsDate } from '@dh-utils/common';
utilsDate.NAME // date
⌂ compare(date,date) : number
- popis : compare date
- return type : {number} -1|0|1
- parametr 1 : {date}
- parametr 2 : {date}
usage :
import { utilsDate } from '@dh-utils/common';
let date1 = new Date(2015,5,5);
let date2 = new Date(2015,5,6);
let result = utilsDate.compare(date1,date2); // -1
⌂ copy(date) : boolean
- popis : deep copy date
- return type : {date}
- parametr 1 : {date}
usage :
import { utilsDate } from '@dh-utils/common';
const date = new Date(2016,1,1);
utilsDate.copy(date); // Date(2016,1,1)
⌂ equal(date,date) : boolean
- popis : equal two dates
- return type : {boolean}
- parametr 1 : {date}
- parametr 2 : {date}
usage :
import { utilsDate } from '@dh-utils/common';
utilsDate.equal(new Date(2015,5,5),new Date(2015,5,6)); // false
⌂ is(any) : boolean
- popis : is a value of type date? same function as utilsCommon.isDate
- return type : {boolean}
- parametr a : {any}
usage :
import { utilsDate } from '@dh-utils/common';
utilsDate.is(new Date(2015,5,5)); // true
utilsDate.is(0); // false
⌂ API - Local functions by type Function
⌂ NAME
- popis : constant NAME="function"
použití :
import { utilsFunction } from '@dh-utils/common';
utilsFunction.NAME // function
⌂ compare(function,function) : number
- popis : compare two functions
- return type : {number} -1,0,1
- parametr a : {function}
- parametr b : {function}
usage :
import { utilsFunction } from '@dh-utils/common';
utilsFunction.compare(()=>"a",()=>"b"); // -1
⌂ copy(function) : boolean
- popis : copy function
- return type : {function}
- parametr 1 : {function}
usage :
import { utilsFunction } from '@dh-utils/common';
const func = function(a){return a};
utilsFunction.copy(func); // function(a){return a};
⌂ equal(function,function) : boolean
- popis : equal two functions
- return type : {function}
- parametr 1 : {function}
- parametr 2 : {function}
usage :
import { utilsFunction } from '@dh-utils/common';
const func1 = function(){return "func1"};
const func2 = function(){return "func2"};
utilsFunction.equal(func1,func2); // false
⌂ is(any) : boolean
- popis : is a value of type function? same function as utilsCommon.isFunction
- return type : {boolean}
- parametr a : {any}
usage :
import { utilsFunction } from '@dh-utils/common';
utilsFunction.is(function(){return "func"}); // true
utilsFunction.is(0); // false
⌂ API - Local functions by type Null
⌂ NAME
- popis : constant NAME="null"
použití :
import { utilsNull } from '@dh-utils/common';
utilsNull.NAME // null
⌂ compare(null,null) : number
- popis : compare null
- return type : {number} -1|0|1
- parametr a : {null}
- parametr b : {null}
usage :
import { utilsNull } from '@dh-utils/common';
utilsNull.compare(null,null); // 0
⌂ copy(null) : null
- popis : copy null
- return type : {null}
- parametr target : {null}
usage :
import { utilsNull } from '@dh-utils/common';
utilsNull.copy(null); // null
⌂ equal(null,null) : boolean
- popis : equal boolean
- return type : {boolean} true
- parametr a : {null}
- parametr b : {null}
usage :
import { utilsNull } from '@dh-utils/common';
utilsNull.equal(null,null); // true
⌂ is(any) : boolean
- popis : is a value null? same function as utilsCommon.isNull
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { utilsNull } from '@dh-utils/common';
utilsNull.is(null); // true
utilsNull.is(0); // false
⌂ API - Local functions by type Number
⌂ NAME
- popis : constant NAME="number"
použití :
import { utilsNumber } from '@dh-utils/common';
utilsNumber.NAME // number
⌂ compare(number,number) : number
- popis : compare number
- return type : {number} -1|0|1
- parametr a : {number}
- parametr b : {number}
usage :
import { utilsNumber } from '@dh-utils/common';
utilsNumber.compare(10,15); // -1
⌂ copy(number) : number
- popis : copy number
- return type : {number}
- parametr target : {number}
usage :
import { utilsNumber } from '@dh-utils/common';
utilsNumber.copy(10); // 10
⌂ equal(number,number) : boolean
- popis : equal two numbers
- return type : {boolean} false,true
- parametr a : {number}
- parametr b : {number}
usage :
import { utilsNumber } from '@dh-utils/common';
utilsNumber.equal(10,10); // true
utilsNumber.equal(5,10); // false
⌂ is(any) : boolean
- popis : is a value of type number? same function as utilsCommon.isNumber
- return type : {boolean}
- parametr a : {any}
usage :
import { utilsNumber } from '@dh-utils/common';
utilsNumber.is(10); // true
utilsNumber.is("10"); // false
⌂ API - Local functions by type Object
⌂ NAME
- popis : constant NAME="object"
použití :
import { utilsObject } from '@dh-utils/common';
utilsObject.NAME // object
⌂ compare(object,object) : number
- popis : compare objects
- return type : {number} -1|0|1
- parametr a : {object}
- parametr b : {object}
usage :
import { utilsObject } from '@dh-utils/common';
utilsObject.compare({name: "John", age: 42},{name: "John", age: 42}); // 0
utilsObject.compare({nameX: "John", age: 42},{name: "John", age: 42}); // 1
utilsObject.compare({name: "JohnX", age: 42},{name: "John", age: 42}); // 1
⌂ copy(object) : object
- popis : copy deep bject
- return type : {object}
- parametr target : {object}
usage :
import { utilsObject } from '@dh-utils/common';
utilsObject.copy({name: "John", age: 42}); // {name: "John", age: 42}
⌂ equal(object,object) : boolean
- popis : equal objects
- return type : {boolean} true
- parametr a : {object}
- parametr b : {object}
usage :
import { utilsObject } from '@dh-utils/common';
utilsObject.equal({name: "John", age: 42}, {name: "John", age: 42}); // true
utilsObject.equal({name: "John", age: 42}, {name: "John", age: 43}); // false
⌂ is(any) : boolean
- popis : is a value of type object? same function as utilsCommon.isObject
- return type : {boolean} true|false
- parametr a : {any}
usage :
import { utilsObject } from '@dh-utils/common';
utilsObject.is({}); // true
utilsObject.is(0); // false
⌂ isEmpty(object) : boolean
- popis : is an object empty ?
- return type : {boolean} true|false
- parametr a : {object}
usage :
import { utilsObject } from '@dh-utils/common';
utilsObject.isEmpty({}); // true
utilsObject.isEmpty({a: 0}}); // false
⌂ isNotEmpty(object) : boolean
- popis : is not an object empty ?
- return type : {boolean} true|false
- parametr a : {object}
usage :
import { utilsObject } from '@dh-utils/common';
utilsObject.isNotEmpty({}); // false
utilsObject.isNotEmpty({a: 0}}); // true
⌂ API - Local functions by type RegExp
⌂ NAME
- popis : constant NAME="regExp"
použití :
import { utilsRegExp } from '@dh-utils/common';
utilsRegExp.NAME // regExp
⌂ compare(regexp,regexp) : number
- popis : compare regexp
- return type : {number} -1|0|1
- parametr a : {regexp}
- parametr b : {regexp}
usage :
import { utilsRegExp } from '@dh-utils/common';
utilsRegExp.compare(/ab+c/,/ab+c/); // 0
utilsRegExp.compare(/ac+c/,/ab+c/); // -1
⌂ copy(regexp) : regexp
- popis : copy RegExp
- return type : {regexp}
- parametr target : {regexp}
usage :
import { utilsRegExp } from '@dh-utils/common';
utilsRegExp.copy(/ab+c/); // /ab+c/
⌂ equal(regexp,regexp) : boolean
- popis : equal RegExp
- return type : {boolean} false,true
- parametr a : {regexp}
- parametr b : {regexp}
usage :
import { utilsRegExp } from '@dh-utils/common';
utilsRegExp.equal(/ab+c/,/ab+c/); // true
utilsRegExp.equal(/ac+c/,/ab+c/); // false
⌂ is(regexp) : boolean
- popis : is a value of type regexp? same function as utilsCommon.isRegExp
- return type : {boolean}
- parametr a : {any}
usage :
import { utilsRegExp } from '@dh-utils/common';
utilsRegExp.is(/ab+c/); // true
utilsRegExp.is(0); // false
⌂ API - Local functions by type String
⌂ NAME
- popis : constant NAME="string"
použití :
import { utilsString } from '@dh-utils/common';
utilsString.NAME // string
⌂ compare(string,string) : number
- popis : compare string
- return type : {number} -1|0|1
- parametr a : {string}
- parametr b : {string}
usage :
import { utilsString } from '@dh-utils/common';
utilsString.compare("ABC","ZXY"); // -1
⌂ copy(string) : boolean
- popis : copy string
- return type : {boolean}
- parametr target : {boolean}
usage :
import { utilsString } from '@dh-utils/common';
utilsString.copy("abc"); // abc
⌂ equal(string,string) : boolean
- popis : equal string
- return type : {boolean} false,true
- parametr a : {string}
- parametr b : {string}
usage :
import { utilsString } from '@dh-utils/common';
utilsString.equal("ABC","ZXY"); // false
⌂ is(any) : boolean
- popis : is a value of type string? same function as utilsCommon.isString
- return type : {boolean}
- parametr a : {any}
usage :
import { utilsString } from '@dh-utils/common';
utilsString.is("abc"); // true
utilsString.is(0); // false
⌂ isEmpty(string) : boolean
- popis : is a string empty?
- return type : {boolean}
- parametr a : {string}
usage :
import { utilsString } from '@dh-utils/common';
utilsString.isEmpty("abc"); // false
utilsString.isEmpty(""); // true
⌂ isNotEmpty(string) : boolean
- popis : is not a string empty?
- return type : {boolean}
- parametr a : {string}
usage :
import { utilsString } from '@dh-utils/common';
utilsString.isNotEmpty("abc"); // false
utilsString.isNotEmpty(""); // true
⌂ API - Local functions by type Symbol
⌂ NAME
- popis : constant NAME="symbol"
použití :
import { utilsSymbol } from '@dh-utils/common';
utilsSymbol.NAME // symbol
⌂ compare(symbol,symbol) : number
- popis : compare symbol
- return type : {number} -1|0|1
- parametr a : {symbol}
- parametr b : {boolean}
usage :
import { utilsSymbol } from '@dh-utils/common';
// TODO
⌂ copy(symbol) : symbol
- popis : copy symbol
- return type : {symbol}
- parametr target : {symbol}
usage :
import { utilsSymbol } from '@dh-utils/common';
// TODO
⌂ equal(symbol,symbol) : boolean
- popis : equal symbol
- return type : {boolean} false,true
- parametr a : {symbol}
- parametr b : {symbol}
usage :
import { utilsSymbol } from '@dh-utils/common';
// TODO
⌂ is(any) : boolean
- popis : is a value of type symbol? same function as utilsCommon.isSymbol
- return type : {boolean}
- parametr a : {any}
usage :
import { utilsSymbol } from '@dh-utils/common';
// TODO
⌂ API - Local functions by type Undefined
⌂ NAME
- popis : constant NAME="undefined"
použití :
import { utilsUndefined } from '@dh-utils/common';
utilsUndefined.NAME // undefined
⌂ compare(undefined,undefined) : number
- popis : compare undefined
- return type : {number} 0
- parametr a : {undefined}
- parametr b : {undefined}
usage :
import { utilsUndefined } from '@dh-utils/common';
utilsUndefined.compare(undefined,undefined); // 0
⌂ copyundefined) : undefined
- popis : copy undefned
- return type : {undefned}
- parametr target : {undefned}
usage :
import { utilsUndefined } from '@dh-utils/common';
utilsUndefined.copy(undefined); // undefined
⌂ equal(undefined,undefined) : boolean
- popis : equal undefined
- return type : {boolean} true
- parametr a : {undefined}
- parametr b : {undefined}
usage :
import { utilsUndefined } from '@dh-utils/common';
utilsUndefined.equal(undefined,undefined); // true
⌂ is(any) : boolean
- popis : is a value of type undefined? same function as utilsCommon.isUndefined
- return type : {boolean}
- parametr a : {any}
usage :
import { utilsUndefined } from '@dh-utils/common';
utilsUndefined.is(undefined); // true
utilsUndefined.is(0); // false