ev-test

1.0.2 • Public • Published

Some basic DIY functions

Install

  • npm install ev-test

Usage

  • import util from 'ev-test'

Functions

  • Get the value of name in querystring:

      query(name, querystring)
      
      // query('hello', '?hello=js') => 'js'
    
  • Serilize data:

      serialize(data)
    
      // serialize({hello: 'js', hi: 'test'}) => 'hello=js&hi=test'
    
  • Search DOM with selector:

      $(selector)
    
  • Remove the node from DOM:

      removeNode(node)
    
  • Insert node after target as a sibling in DOM:

      insertAfter(node, target)
    
  • Add className, which could be an array or a string, to the class list of target

      addClass(node, className)
    
  • Remove className, which could be an array or a string, from the class list of target

      removeClass(node, className)
    
  • Get the absolute URL of a relative URL in current page

      getAbsoluteUrl(url)
    
      // getAbsoluteUrl('/abc') => 'https://www.npmjs.com/abc'
    
  • Debouce, to avoid shaking of the window

      debounce(callback, time)
    
  • Remove the element of index from arr

      removeItemByIndex(index, arr) 
    
      // removeItemByIndex(1, [1,2,3]) => [1, 3]
    

Readme

Keywords

none

Package Sidebar

Install

npm i ev-test

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

20.1 kB

Total Files

12

Last publish

Collaborators

  • nagger