cc-obj
v1.0.2
Published
object's some util functon.
Downloads
5
Maintainers
Readme
Object's some util function.
Usage
import { copy, isObject, merge, isEqual, debounce, throttle } from 'cc-obj'
const data = { a: 1, b: 2 }
console.log(isObject(data)) // true
const copyData = copy(data)
copyData.a = 2
console.log(copyData) // {a: 2, b: 2}
console.log(isEqual(data, copyData)) // false
const data2 = data
console.log(isEqual(data, data2)) // true
const s1 = { b: 3, c: 'c' }
const s2 = { d: 'd' }
console.log(merge(...[data, s1, s2])) // {a: 1, b: 3, c: "c", d: "d"}
$('textarea').on('keydown', debounce(ajaxAction, 2500));
window.addEventListener('scroll', throttle(callback, 1000));