UNPKG

@visulima/humanizer

Version:

Humanizer is a library for humanizing data in a human-readable form.

17 lines (14 loc) 590 B
import createDurationLanguage from './util/create-duration-language.mjs'; const durationLanguage = createDurationLanguage( (counter) => `year${counter === 1 ? "" : "s"}`, (counter) => `month${counter === 1 ? "" : "s"}`, (counter) => `week${counter === 1 ? "" : "s"}`, (counter) => `day${counter === 1 ? "" : "s"}`, (counter) => `hour${counter === 1 ? "" : "s"}`, (counter) => `minute${counter === 1 ? "" : "s"}`, (counter) => `second${counter === 1 ? "" : "s"}`, (counter) => `millisecond${counter === 1 ? "" : "s"}`, "in %s", "%s ago" ); export { durationLanguage };