Often used in the work of a number of methods, or to do type judgment, data conversion and so on, in order to facilitate, some functions packaged into a function of the tool set Lao-utils
Use
Node.js
NPM Install Lao-utils--save
Amd/cmd, browser environment
Introduction of dist Directory source files
Function
UUID () generates a UUID string (pseudo GUID)
Is (x,y) compares character X and character y for equality
Eg: special example: Laoutils.is ( -0,+0); False,laoutils.is (Nan,nan); True
whether Isinteger (value) is an integer
Whether Isnumber (value) is a number
Whether isstring (value) is a string
Whether isNaN (value) is Nan
Isdom (obj) to determine if obj is a DOM object
Date (Format,timestamp) formatting dates
Eg:laoUtils.date (' Yyyy-mm-dd '); 2016-02-26
CopyObject (obj) copy objects (shallow copy, and undefined properties will not be replicated)
Clone (obj) makes a deep copy of an object
Merge (A,b,c,... rest) Merging objects
Eg:laoUtils.merge ({a:1},{b:2},{b:3,c:3}); {A:1,b:3,c:3}
ArrayOf (a,b,c,... rest) Converts a set of values to an array (converting arguments to arrays)
Eg:laoUtils.arrayOf (1,2,3); [1,2,3]
Includes (arr,value) array arr contains the given value.
Eg:laoUtils.includes ([1,2,3],3); True
Contains (Str,value) determines whether a string is contained in another string.
Eg:laoUtils.contains (' Giscafer ', ' G '); True
IsArray (arr) determines whether ARR is an array
Inherits (Clazz, Baseclazz) constructs a class inheritance relationship (Clazz inherits from Baseclazz)
Extend (DES, source) source object The properties of all attributes are copied to the target object des (undefined properties are not replicated)
Source
This site downloads http://xiazai.jb51.net/201603/yuanma/lao-utils-master (jb51.net). zip
Github