1.0.15 • Published 6 years ago
jscommonutils v1.0.15
javaScript Commonly used tools
Installation
npm install --save jscommonutils
node
var jscommonutils = require('jscommonutils')
AMD
define(function (require, exports, module) {
var jscommonutils = require('jscommonutils')
})
##OverView
this API is include many utils which we Frequently used. Here are all the tools included in this package.
- deppClone(origin, target).this method requests us pass two parameters, The first parameter is the cloned template, and the second parameter as the object we will clone to. it do not return a value, so the target must be a quote. Notes: origin must be object, but the target can be object or array.
- dataType (target).this method requests us to pass one parameter, it represents the goal of the judge.In different case, it returns a different String. They're listed In the following.
- number: 1,2,3...
- string : '1', '2' ,'dad'...
- boolean : true or fasle
- undefined : undefined
- function: function () {}...
- Array: []
- null: null
- String: var a = new String('qqq')
- Boolean: var a = new Boolean('qqq')
- Number: var a = new Number('qqq')
- object: {} or var a = new Object('qqq')
- arrayUnique(arr).this method is used to get rid of the repeat.It return a new array.
- getScrollOffset. this method is used to get the Scrill Offset from the top and left.
- getViewportOffset.this method is used to get the content's height and width
- getElementOffset.this method is used to get the location of the element from the top and left.
##Usage
const { datatype, deppClone } = require('jscommonutils')
const jscommonutils = require('jscommonutils')
jscommonutils.datatype()
jscommonutils.deppClone()