accounts-frontend/src/functions.js
2016-07-29 20:16:06 +03:00

21 lines
340 B
JavaScript

let lastId = 0;
export function uniqueId(prefix = 'id') {
return `${prefix}${++lastId}`;
}
/**
* @param {object} obj
* @param {array} keys
*
* @return {object}
*/
export function omit(obj, keys) {
const newObj = {...obj};
keys.forEach((key) => {
Reflect.deleteProperty(newObj, key);
});
return newObj;
}