You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
901 B
33 lines
901 B
export default {
|
|
copyObject(source) {
|
|
const result = {};
|
|
for (const field in source) {
|
|
if (source.hasOwnProperty(field)) {
|
|
result[field] = source[field];
|
|
}
|
|
}
|
|
return result;
|
|
},
|
|
setValue(destination, source, callback) {
|
|
for (const key in source) {
|
|
if (source.hasOwnProperty(key)) {
|
|
let element = source[key];
|
|
destination[key] = callback ? callback(element) : element;
|
|
}
|
|
}
|
|
},
|
|
debounce(fn, wait) {
|
|
let timeout = null;
|
|
return function () {
|
|
let context = this;
|
|
let args = arguments;
|
|
if (timeout !== null) {
|
|
clearTimeout(timeout);
|
|
}
|
|
timeout = setTimeout(function () {
|
|
fn.apply(context, args);
|
|
}, wait);
|
|
}
|
|
},
|
|
|
|
};
|
|
|