1.0.8 • Published 6 years ago

basic-tools v1.0.8

Weekly downloads
3
License
ISC
Repository
-
Last release
6 years ago

basic-tools

  • Common utility function packages(常用的实用工具函数包)
  • npm-url:npm
  • github-url:github

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]
1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago