@d3plus/format 3.0.16 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,110 +4,6 @@
4
4
  Copyright (c) 2026 D3plus - https://d3plus.org
5
5
  @license MIT
6
6
  */
7
-
8
- (function (factory) {
9
- typeof define === 'function' && define.amd ? define(factory) :
10
- factory();
11
- })((function () { 'use strict';
12
-
13
- if (typeof window !== "undefined") {
14
- (function () {
15
- try {
16
- if (typeof SVGElement === 'undefined' || Boolean(SVGElement.prototype.innerHTML)) {
17
- return;
18
- }
19
- } catch (e) {
20
- return;
21
- }
22
-
23
- function serializeNode (node) {
24
- switch (node.nodeType) {
25
- case 1:
26
- return serializeElementNode(node);
27
- case 3:
28
- return serializeTextNode(node);
29
- case 8:
30
- return serializeCommentNode(node);
31
- }
32
- }
33
-
34
- function serializeTextNode (node) {
35
- return node.textContent.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
36
- }
37
-
38
- function serializeCommentNode (node) {
39
- return '<!--' + node.nodeValue + '-->'
40
- }
41
-
42
- function serializeElementNode (node) {
43
- var output = '';
44
-
45
- output += '<' + node.tagName;
46
-
47
- if (node.hasAttributes()) {
48
- [].forEach.call(node.attributes, function(attrNode) {
49
- output += ' ' + attrNode.name + '="' + attrNode.value + '"';
50
- });
51
- }
52
-
53
- output += '>';
54
-
55
- if (node.hasChildNodes()) {
56
- [].forEach.call(node.childNodes, function(childNode) {
57
- output += serializeNode(childNode);
58
- });
59
- }
60
-
61
- output += '</' + node.tagName + '>';
62
-
63
- return output;
64
- }
65
-
66
- Object.defineProperty(SVGElement.prototype, 'innerHTML', {
67
- get: function () {
68
- var output = '';
69
-
70
- [].forEach.call(this.childNodes, function(childNode) {
71
- output += serializeNode(childNode);
72
- });
73
-
74
- return output;
75
- },
76
- set: function (markup) {
77
- while (this.firstChild) {
78
- this.removeChild(this.firstChild);
79
- }
80
-
81
- try {
82
- var dXML = new DOMParser();
83
- dXML.async = false;
84
-
85
- var sXML = '<svg xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\'>' + markup + '</svg>';
86
- var svgDocElement = dXML.parseFromString(sXML, 'text/xml').documentElement;
87
-
88
- [].forEach.call(svgDocElement.childNodes, function(childNode) {
89
- this.appendChild(this.ownerDocument.importNode(childNode, true));
90
- }.bind(this));
91
- } catch (e) {
92
- throw new Error('Error parsing markup string');
93
- }
94
- }
95
- });
96
-
97
- Object.defineProperty(SVGElement.prototype, 'innerSVG', {
98
- get: function () {
99
- return this.innerHTML;
100
- },
101
- set: function (markup) {
102
- this.innerHTML = markup;
103
- }
104
- });
105
-
106
- })();
107
- }
108
-
109
- }));
110
-
111
7
  (function (global, factory) {
112
8
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
113
9
  typeof define === 'function' && define.amd ? define('@d3plus/format', ['exports'], factory) :
@@ -120,8 +16,8 @@
120
16
  // significant digits p, where x is positive and p is in [1, 21] or undefined.
121
17
  // For example, formatDecimalParts(1.23) returns ["123", 0].
122
18
  function formatDecimalParts(x, p) {
123
- if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
124
- var i, coefficient = x.slice(0, i);
19
+ if (!isFinite(x) || x === 0) return null; // NaN, ±Infinity, ±0
20
+ var i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e"), coefficient = x.slice(0, i);
125
21
  // The string returned by toExponential either has the form \d\.\d+e[-+]\d+
126
22
  // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
127
23
  return [
@@ -213,7 +109,7 @@
213
109
  var prefixExponent;
214
110
  function formatPrefixAuto(x, p) {
215
111
  var d = formatDecimalParts(x, p);
216
- if (!d) return x + "";
112
+ if (!d) return prefixExponent = undefined, x.toPrecision(p);
217
113
  var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length;
218
114
  return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!
219
115
  }
@@ -264,9 +160,9 @@
264
160
  "Z",
265
161
  "Y"
266
162
  ];
267
- function formatLocale$1(locale) {
163
+ function formatLocale$2(locale) {
268
164
  var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""), currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", decimal = locale.decimal === undefined ? "." : locale.decimal + "", numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)), percent = locale.percent === undefined ? "%" : locale.percent + "", minus = locale.minus === undefined ? "−" : locale.minus + "", nan = locale.nan === undefined ? "NaN" : locale.nan + "";
269
- function newFormat(specifier) {
165
+ function newFormat(specifier, options) {
270
166
  specifier = formatSpecifier(specifier);
271
167
  var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type;
272
168
  // The "n" type is an alias for ",g".
@@ -276,7 +172,7 @@
276
172
  if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "=";
277
173
  // Compute the prefix and suffix.
278
174
  // For SI-prefix, the suffix is lazily computed.
279
- var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";
175
+ var prefix = (options && options.prefix !== undefined ? options.prefix : "") + (symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : ""), suffix = (symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "") + (options && options.suffix !== undefined ? options.suffix : "");
280
176
  // What format function should we use?
281
177
  // Is this an integer type?
282
178
  // Can this type generate exponential notation?
@@ -303,7 +199,7 @@
303
199
  if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
304
200
  // Compute the prefix and suffix.
305
201
  valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
306
- valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
202
+ valueSuffix = (type === "s" && !isNaN(value) && prefixExponent !== undefined ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
307
203
  // Break the formatted value into the integer “value” part that can be
308
204
  // grouped, and fractional or exponential “suffix” part that is not.
309
205
  if (maybeSuffix) {
@@ -346,9 +242,11 @@
346
242
  return format;
347
243
  }
348
244
  function formatPrefix(specifier, value) {
349
- var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3];
245
+ var e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, k = Math.pow(10, -e), f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier), {
246
+ suffix: prefixes[8 + e / 3]
247
+ });
350
248
  return function(value) {
351
- return f(k * value) + prefix;
249
+ return f(k * value);
352
250
  };
353
251
  }
354
252
  return {
@@ -359,7 +257,7 @@
359
257
 
360
258
  var locale$1;
361
259
  var format$1;
362
- defaultLocale$2({
260
+ defaultLocale$1({
363
261
  thousands: ",",
364
262
  grouping: [
365
263
  3
@@ -369,8 +267,8 @@
369
267
  ""
370
268
  ]
371
269
  });
372
- function defaultLocale$2(definition) {
373
- locale$1 = formatLocale$1(definition);
270
+ function defaultLocale$1(definition) {
271
+ locale$1 = formatLocale$2(definition);
374
272
  format$1 = locale$1.format;
375
273
  locale$1.formatPrefix;
376
274
  return locale$1;
@@ -378,8 +276,8 @@
378
276
 
379
277
  /**
380
278
  @namespace {Object} formatLocale
381
- @desc A set of default locale formatters used when assigning suffixes and currency in numbers.
382
- */ var defaultLocale$1 = {
279
+ A set of default locale formatters used when assigning suffixes and currency in numbers.
280
+ */ var formatLocale$1 = {
383
281
  "ar-SA": {
384
282
  separator: "",
385
283
  suffixes: [
@@ -389,17 +287,17 @@
389
287
  "f",
390
288
  "p",
391
289
  "n",
392
- "µ",
290
+ "\u00b5",
393
291
  "m",
394
292
  "",
395
- " ألف",
396
- " مليون",
397
- " بليون",
398
- " تريليون",
399
- " كوادريليون",
400
- " كوينتيليون",
401
- " سكستليون",
402
- "سبتيليون"
293
+ " \u0623\u0644\u0641",
294
+ " \u0645\u0644\u064a\u0648\u0646",
295
+ " \u0628\u0644\u064a\u0648\u0646",
296
+ " \u062a\u0631\u064a\u0644\u064a\u0648\u0646",
297
+ " \u0643\u0648\u0627\u062f\u0631\u064a\u0644\u064a\u0648\u0646",
298
+ " \u0643\u0648\u064a\u0646\u062a\u064a\u0644\u064a\u0648\u0646",
299
+ " \u0633\u0643\u0633\u062a\u0644\u064a\u0648\u0646",
300
+ "\u0633\u0628\u062a\u064a\u0644\u064a\u0648\u0646"
403
301
  ],
404
302
  grouping: [
405
303
  3
@@ -422,7 +320,7 @@
422
320
  "f",
423
321
  "p",
424
322
  "n",
425
- "µ",
323
+ "\u00b5",
426
324
  "m",
427
325
  "",
428
326
  "k",
@@ -442,7 +340,7 @@
442
340
  decimal: "."
443
341
  },
444
342
  currency: [
445
- "£",
343
+ "\u00a3",
446
344
  ""
447
345
  ]
448
346
  },
@@ -455,7 +353,7 @@
455
353
  "f",
456
354
  "p",
457
355
  "n",
458
- "µ",
356
+ "\u00b5",
459
357
  "m",
460
358
  "",
461
359
  "k",
@@ -488,7 +386,7 @@
488
386
  "f",
489
387
  "p",
490
388
  "n",
491
- "µ",
389
+ "\u00b5",
492
390
  "m",
493
391
  "",
494
392
  " thousand",
@@ -521,7 +419,7 @@
521
419
  "f",
522
420
  "p",
523
421
  "n",
524
- "µ",
422
+ "\u00b5",
525
423
  "m",
526
424
  "",
527
425
  "k",
@@ -554,7 +452,7 @@
554
452
  "f",
555
453
  "p",
556
454
  "n",
557
- "µ",
455
+ "\u00b5",
558
456
  "m",
559
457
  "",
560
458
  "k",
@@ -587,7 +485,7 @@
587
485
  "f",
588
486
  "p",
589
487
  "n",
590
- "µ",
488
+ "\u00b5",
591
489
  "m",
592
490
  "",
593
491
  "k",
@@ -607,7 +505,7 @@
607
505
  decimal: ","
608
506
  },
609
507
  currency: [
610
- "",
508
+ "\u20ac",
611
509
  ""
612
510
  ]
613
511
  },
@@ -620,7 +518,7 @@
620
518
  "f",
621
519
  "p",
622
520
  "n",
623
- "µ",
521
+ "\u00b5",
624
522
  "m",
625
523
  "",
626
524
  "tuhat",
@@ -652,7 +550,7 @@
652
550
  "f",
653
551
  "p",
654
552
  "n",
655
- "µ",
553
+ "\u00b5",
656
554
  "m",
657
555
  "",
658
556
  "k",
@@ -672,30 +570,30 @@
672
570
  decimal: ","
673
571
  },
674
572
  currency: [
675
- "",
573
+ "\u20ac",
676
574
  ""
677
575
  ]
678
576
  },
679
577
  "zh-CN": {
680
578
  separator: "",
681
579
  suffixes: [
682
- "",
683
- "",
684
- "",
685
- "",
686
- "",
687
- "",
688
- "",
689
- "",
580
+ "\u5e7a",
581
+ "\u4ed4",
582
+ "\u963f",
583
+ "\u98de",
584
+ "\u76ae",
585
+ "\u7eb3",
586
+ "\u5fae",
587
+ "\u6beb",
690
588
  "",
691
- "",
692
- "",
693
- "",
694
- "",
695
- "",
696
- "",
697
- "",
698
- ""
589
+ "\u5343",
590
+ "\u5146",
591
+ "\u5409",
592
+ "\u592a",
593
+ "\u62cd",
594
+ "\u827e",
595
+ "\u6cfd",
596
+ "\u5c27"
699
597
  ],
700
598
  grouping: [
701
599
  3
@@ -705,18 +603,18 @@
705
603
  decimal: "."
706
604
  },
707
605
  currency: [
708
- "¥",
606
+ "\u00a5",
709
607
  ""
710
608
  ]
711
609
  }
712
610
  };
713
611
 
714
- const round = (x, n)=>parseFloat(Math.round(x * Math.pow(10, n)) / Math.pow(10, n)).toFixed(n);
612
+ const round = (x, n)=>parseFloat((Math.round(x * Math.pow(10, n)) / Math.pow(10, n)).toString()).toFixed(n);
715
613
  /**
716
614
  * @private
717
- */ function formatSuffix(str, precision, suffixes) {
615
+ */ function formatSuffix(str, precision, suffixes) {
718
616
  let i = 0;
719
- let value = parseFloat(str.replace("", "-"), 10);
617
+ let value = parseFloat(str.replace("\u2212", "-"));
720
618
  if (value) {
721
619
  if (value < 0) value *= -1;
722
620
  i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
@@ -730,7 +628,7 @@
730
628
  }
731
629
  /**
732
630
  * @private
733
- */ function parseSuffixes(d, i) {
631
+ */ function parseSuffixes(d, i) {
734
632
  const k = Math.pow(10, Math.abs(8 - i) * 3);
735
633
  return {
736
634
  scale: i > 8 ? (d)=>d / k : (d)=>d * k,
@@ -738,18 +636,17 @@
738
636
  };
739
637
  }
740
638
  /**
741
- @function formatAbbreviate
742
- @desc Formats a number to an appropriate number of decimal places and rounding, adding suffixes if applicable (ie. `1200000` to `"1.2M"`).
743
- @param {Number|String} n The number to be formatted.
744
- @param {Object|String} locale The locale config to be used. If *value* is an object, the function will format the numbers according the object. The object must include `suffixes`, `delimiter` and `currency` properties.
745
- @returns {String}
746
- */ function abbreviate(n, locale = "en-US", precision = undefined) {
747
- if (isFinite(n)) n *= 1;
639
+ Formats a number to an appropriate number of decimal places and rounding, adding suffixes if applicable (ie. `1200000` to `"1.2M"`).
640
+ @param n The number to be formatted.
641
+ @param locale The locale config to be used. If an object is provided, the function will format the numbers according to the object. The object must include `suffixes`, `delimiter` and `currency` properties.
642
+ @param precision Number of significant digits to display.
643
+ */ function formatAbbreviate(n, locale = "en-US", precision) {
644
+ if (isFinite(n)) n = n * 1;
748
645
  else return "N/A";
749
646
  const negative = n < 0;
750
- const length = n.toString().split(".")[0].replace("-", "").length, localeConfig = typeof locale === "object" ? locale : defaultLocale$1[locale] || defaultLocale$1["en-US"], suffixes = localeConfig.suffixes.map(parseSuffixes);
647
+ const length = n.toString().split(".")[0].replace("-", "").length, localeConfig = typeof locale === "object" ? locale : formatLocale$1[locale] || formatLocale$1["en-US"], suffixes = localeConfig.suffixes.map(parseSuffixes);
751
648
  const decimal = localeConfig.delimiters.decimal || ".", separator = localeConfig.separator || "", thousands = localeConfig.delimiters.thousands || ",";
752
- const d3plusFormatLocale = formatLocale$1({
649
+ const d3plusFormatLocale = formatLocale$2({
753
650
  currency: localeConfig.currency || [
754
651
  "$",
755
652
  ""
@@ -771,31 +668,24 @@
771
668
  } else if (length === 3) val = d3plusFormatLocale.format(",f")(n);
772
669
  else if (n < 1 && n > -1) val = d3plusFormatLocale.format(".2g")(n);
773
670
  else val = d3plusFormatLocale.format(".3g")(n);
774
- return `${negative && val.charAt(0) !== "" ? "" : ""}${val}`.replace(/−/g, "-") // replace new d3 default minus sign () to hyphen-minus (-)
671
+ return `${negative && val.charAt(0) !== "\u2212" ? "\u2212" : ""}${val}`.replace(/\u2212/g, "-") // replace new d3 default minus sign (\u2212) to hyphen-minus (-)
775
672
  .replace(/(\.[0]*[1-9]*)[0]*$/g, "$1") // removes any trailing zeros
776
673
  .replace(/\.[0]*$/g, ""); // removes any trailing decimal point
777
674
  }
778
675
 
779
- /**
780
- @function format
781
- @desc An extension to d3's [format](https://github.com/d3/d3-format#api-reference) function that adds more string formatting types and localizations.
782
- @param {String} specifier The string specifier used by the format function.
783
- @returns {Function}
784
- */ var format = ((specifier)=>{
785
- if (specifier === ".3~a") return abbreviate;
676
+ function format(specifier) {
677
+ if (specifier === ".3~a") return formatAbbreviate;
786
678
  return format$1(specifier);
787
- });
679
+ }
788
680
 
789
681
  /**
790
- @function formatDefaultLocale
791
- @desc An extension to d3's [formatDefaultLocale](https://github.com/d3/d3-format#api-reference) function that allows setting the locale globally for formatters.
792
- @param {Object} definition The localization definition.
793
- @returns {Object}
794
- */ var formatDefaultLocale = ((definition)=>{
795
- const locale = defaultLocale$2(definition);
682
+ An extension to d3's [formatDefaultLocale](https://github.com/d3/d3-format#api-reference) function that allows setting the locale globally for formatters.
683
+ @param definition The localization definition.
684
+ */ function formatDefaultLocale(definition) {
685
+ const locale = defaultLocale$1(definition);
796
686
  locale.format = format;
797
687
  return locale;
798
- });
688
+ }
799
689
 
800
690
  const t0 = new Date, t1 = new Date;
801
691
  function timeInterval(floori, offseti, count, field) {
@@ -1678,12 +1568,10 @@
1678
1568
  }
1679
1569
 
1680
1570
  /**
1681
- @function formatDate
1682
- @desc A default set of date formatters, which takes into account both the interval in between in each data point but also the start/end data points.
1683
- @param {Date} d The date string to be formatted.
1684
- @param {Array} dataArray The full array of ordered Date Objects.
1685
- @param {Function} [formatter = d3.timeFormat] An optional instance of d3.timeFormat to be used for localization.
1686
- @returns {String}
1571
+ A default set of date formatters, which takes into account both the interval in between in each data point but also the start/end data points.
1572
+ @param d The date to format.
1573
+ @param dataArray The full array of ordered Date Objects.
1574
+ @param formatter Optional custom format string or function.
1687
1575
  */ function formatDate(d, dataArray, formatter = timeFormat) {
1688
1576
  const formatHour = formatter("%I %p"), formatMillisecond = formatter(".%L"), formatMinute = formatter("%I:%M"), formatMonth = formatter("%b"), formatMonthDay = formatter("%b %-d"), formatMonthDayYear = formatter("%b %-d, %Y"), formatMonthYear = formatter("%b %Y"), formatQuarter = formatter("Q%q"), formatQuarterYear = formatter("Q%q %Y"), formatSecond = formatter(":%S"), formatYear = formatter("%Y");
1689
1577
  const labelIndex = dataArray.findIndex((a)=>+a === +d);
@@ -1693,8 +1581,8 @@
1693
1581
  if (i) {
1694
1582
  arr[0].push(d.getFullYear() - dataArray[i - 1].getFullYear());
1695
1583
  arr[1].push(monthDiff(dataArray[i - 1], d));
1696
- arr[2].push(Math.round((d - dataArray[i - 1]) / (1000 * 60 * 60 * 24)));
1697
- arr[3].push(Math.round((d - dataArray[i - 1]) / (1000 * 60 * 60)));
1584
+ arr[2].push(Math.round((+d - +dataArray[i - 1]) / (1000 * 60 * 60 * 24)));
1585
+ arr[3].push(Math.round((+d - +dataArray[i - 1]) / (1000 * 60 * 60)));
1698
1586
  }
1699
1587
  return arr;
1700
1588
  }, [
@@ -1703,18 +1591,16 @@
1703
1591
  [],
1704
1592
  []
1705
1593
  ]);
1706
- return (yearlySteps.every((s)=>s >= 1 && !(s % 1)) // Yearly Data
1594
+ return (yearlySteps.every((s)=>s >= 1 && !(s % 1)) // Yearly Data
1707
1595
  ? formatYear : monthlySteps.every((s)=>s >= 3 && !(s % 3)) // Quarterly Data
1708
- ? +timeYear(d) === d || firstOrLast || smallArray ? formatQuarterYear : formatQuarter : monthlySteps.every((s)=>s >= 1 && !(s % 1)) // Monthly Data
1709
- ? +timeYear(d) === d || firstOrLast || smallArray ? formatMonthYear : formatMonth : dailySteps.every((s)=>s >= 1 && !(s % 1)) // Daily Data
1710
- ? +timeYear(d) === d || firstOrLast || smallArray ? formatMonthDayYear : formatMonthDay : hourlySteps.every((s)=>s >= 1 && !(s % 1)) // Hourly Data
1711
- ? firstOrLast || smallArray ? formatMonthDayYear : +timeMonth(d) === d ? formatMonthDay : formatHour : second(d) < d ? formatMillisecond : timeMinute(d) < d ? formatSecond : timeHour(d) < d ? formatMinute : d)(d);
1596
+ ? +timeYear(d) === +d || firstOrLast || smallArray ? formatQuarterYear : formatQuarter : monthlySteps.every((s)=>s >= 1 && !(s % 1)) // Monthly Data
1597
+ ? +timeYear(d) === +d || firstOrLast || smallArray ? formatMonthYear : formatMonth : dailySteps.every((s)=>s >= 1 && !(s % 1)) // Daily Data
1598
+ ? +timeYear(d) === +d || firstOrLast || smallArray ? formatMonthDayYear : formatMonthDay : hourlySteps.every((s)=>s >= 1 && !(s % 1)) // Hourly Data
1599
+ ? firstOrLast || smallArray ? formatMonthDayYear : +timeMonth(d) === +d ? formatMonthDay : formatHour : second(d) < d ? formatMillisecond : timeMinute(d) < d ? formatSecond : timeHour(d) < d ? formatMinute : (_d)=>_d.toString())(d);
1712
1600
  }
1713
1601
  /**
1714
- @function monthDiff
1715
- @desc Returns the number of months between two Date objects
1716
- @param {*} d1
1717
- @param {*} d2
1602
+ Returns the number of months between two Date objects
1603
+
1718
1604
  @returns {Number} the number of months between the two Date objects
1719
1605
  @private
1720
1606
  */ function monthDiff(d1, d2) {
@@ -1726,7 +1612,7 @@
1726
1612
  }
1727
1613
 
1728
1614
  exports.format = format;
1729
- exports.formatAbbreviate = abbreviate;
1615
+ exports.formatAbbreviate = formatAbbreviate;
1730
1616
  exports.formatDate = formatDate;
1731
1617
  exports.formatDefaultLocale = formatDefaultLocale;
1732
1618