MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / humanize

Function humanize

tests/test_code/js/moment/moment.js:5462–5494  ·  view source on GitHub ↗
(argWithSuffix, argThresholds)

Source from the content-addressed store, hash-verified

5460 }
5461
5462 function humanize(argWithSuffix, argThresholds) {
5463 if (!this.isValid()) {
5464 return this.localeData().invalidDate();
5465 }
5466
5467 var withSuffix = false,
5468 th = thresholds,
5469 locale,
5470 output;
5471
5472 if (typeof argWithSuffix === 'object') {
5473 argThresholds = argWithSuffix;
5474 argWithSuffix = false;
5475 }
5476 if (typeof argWithSuffix === 'boolean') {
5477 withSuffix = argWithSuffix;
5478 }
5479 if (typeof argThresholds === 'object') {
5480 th = Object.assign({}, thresholds, argThresholds);
5481 if (argThresholds.s != null && argThresholds.ss == null) {
5482 th.ss = argThresholds.s - 1;
5483 }
5484 }
5485
5486 locale = this.localeData();
5487 output = relativeTime$1(this, !withSuffix, th, locale);
5488
5489 if (withSuffix) {
5490 output = locale.pastFuture(+this, output);
5491 }
5492
5493 return locale.postformat(output);
5494 }
5495
5496 var abs$1 = Math.abs;
5497

Callers

nothing calls this directly

Calls 1

relativeTime$1Function · 0.85

Tested by

no test coverage detected