1.0.4 • Published 8 years ago

util-lib v1.0.4

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

util

一个javascript工具库

usage

npm install util-lib
const util = require('util-lib')
// or
import util from 'util-lib'

trim(s)

const str = '  123  abc '
util.trim(str)  //'123  abc'

throttle(fn, interval)

const fn = util.throttle(() => {
  console.log('scroll')
}, 500)
window.addEventListener('scroll', fn)

debounce(fn, interval)

const fn = util.debounce(e => {
  console.log(e.target.value)
}, 300)
document.querySelector('input').addEventListener('input', fn)

dateFormat(date, pattern)

const date = new Date('Mon Apr 24 2017 GMT+0800')
console.log(date, 'yyyy/MM/dd')  // 2017/04/24
1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago