MCPcopy Create free account
hub / github.com/api-platform/website / humanizer

Function humanizer

pwa/utils/con/humanize-duration.js:61–90  ·  view source on GitHub ↗
(passedOptions)

Source from the content-addressed store, hash-verified

59 // You can create a humanizer, which returns a function with default
60 // parameters.
61 function humanizer(passedOptions) {
62 var result = function humanizer(ms, humanizerOptions) {
63 var options = assign({}, result, humanizerOptions || {});
64 return doHumanization(ms, options);
65 };
66
67 return assign(
68 result,
69 {
70 language: "en",
71 spacer: " ",
72 conjunction: "",
73 serialComma: true,
74 units: ["y", "mo", "w", "d", "h", "m", "s"],
75 languages: {},
76 round: false,
77 unitMeasures: {
78 y: 31557600000,
79 mo: 2629800000,
80 w: 604800000,
81 d: 86400000,
82 h: 3600000,
83 m: 60000,
84 s: 1000,
85 ms: 1,
86 },
87 },
88 passedOptions
89 );
90 }
91
92 // The main function is just a wrapper around a default humanizer.
93 var humanizeDuration = humanizer({});

Callers 1

Calls 1

assignFunction · 0.85

Tested by

no test coverage detected