1.0.8 • Published 6 years ago
basic-tools v1.0.8
basic-tools
Installation
You can install with npm:
$ npm install basic-tools
Usage
import basicTools from 'basic-tools'
Function
query(name, querystring)
- Function for gets the value of the specified name in the specified querystring
basicTools.query('name', '?name=js') //return 'js'
serialize(data)
- Function for turn the object into a url string
basicTools.serialize({hello: 'js'}) //return '?hello=js'
$(selector)
- Function for simulating jQuery
basicTools.$(selector) //return {DOM|undefined}
removeNode(node)
- Function for Deleting DOM node
basicTools.removeNode(node) //delete {node}
insertAfter(node)
- Function for inserting the node node after the target node
basicTools.insertAfter(node, target)
addClass(node, className)
- Function for add class name
basicTools.addClass(node, className) //add class
removeClass(node, className)
- Function for remove class name
basicTools.removeClass(node, className) //removeClass
getAbsoluteUrl(url)
- Function for get absolute url
basicTools.getAbsoluteUrl('/xxxx') //return 'https://github.com/xxxx'
debounce(callback, time)
- Function for avoiding shake
removeItemByIndex(index, arr)
- Function for remove item by index
basicTools.removeItemByIndex(1, [1, 2, 3]) //return [1, 3]