e50b23d081
* chore(js): be stricter about dead code warnings * chore(js): remove dead code and unused exports * rebase * chore: remove unused files * chore(deps): remove unused prop-types dep * chore(js): remove unused function * chore(deps): remove + check unused deps * chore(js): remove unused exports. Closes #3036
23 lines
558 B
JavaScript
23 lines
558 B
JavaScript
export function pluralize(string, count) {
|
|
if (count === 1) {
|
|
return string;
|
|
}
|
|
return `${string}s`;
|
|
}
|
|
|
|
export function getDiffInDaysFromNow(timestamp) {
|
|
const time = typeof timestamp === 'string' ? new Date(timestamp) : timestamp;
|
|
return (new Date() - time) / (24 * 3600 * 1000);
|
|
}
|
|
|
|
// Take a nested object of state metadata and merge it into
|
|
// a single flattened node.
|
|
export function mergeMeta(meta) {
|
|
return Object.keys(meta).reduce((acc, key) => {
|
|
const value = meta[key];
|
|
Object.assign(acc, value);
|
|
|
|
return acc;
|
|
}, {});
|
|
}
|