JavaScript common function toolset: Lao-utils_javascript tips

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.