Change type check and the way of sending params. (#4145)

This commit is contained in:
moonformeli
2019-01-11 16:45:15 +09:00
committed by John-David Dalton
parent a7e0428889
commit afab656cfe

View File

@@ -53,7 +53,7 @@ function throttle(func, wait, options) {
let leading = true let leading = true
let trailing = true let trailing = true
if (typeof func != 'function') { if (typeof func !== 'function') {
throw new TypeError('Expected a function') throw new TypeError('Expected a function')
} }
if (isObject(options)) { if (isObject(options)) {
@@ -61,9 +61,9 @@ function throttle(func, wait, options) {
trailing = 'trailing' in options ? !!options.trailing : trailing trailing = 'trailing' in options ? !!options.trailing : trailing
} }
return debounce(func, wait, { return debounce(func, wait, {
'leading': leading, leading,
trailing,
'maxWait': wait, 'maxWait': wait,
'trailing': trailing
}) })
} }