summaryrefslogtreecommitdiff
path: root/node_modules/moment/src/lib/units/priorities.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/moment/src/lib/units/priorities.js')
-rw-r--r--node_modules/moment/src/lib/units/priorities.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/node_modules/moment/src/lib/units/priorities.js b/node_modules/moment/src/lib/units/priorities.js
new file mode 100644
index 0000000..b42d2fc
--- /dev/null
+++ b/node_modules/moment/src/lib/units/priorities.js
@@ -0,0 +1,34 @@
+import hasOwnProp from '../utils/has-own-prop';
+
+var priorities = {
+ date: 9,
+ day: 11,
+ weekday: 11,
+ isoWeekday: 11,
+ dayOfYear: 4,
+ hour: 13,
+ millisecond: 16,
+ minute: 14,
+ month: 8,
+ quarter: 7,
+ second: 15,
+ weekYear: 1,
+ isoWeekYear: 1,
+ week: 5,
+ isoWeek: 5,
+ year: 1,
+};
+
+export function getPrioritizedUnits(unitsObj) {
+ var units = [],
+ u;
+ for (u in unitsObj) {
+ if (hasOwnProp(unitsObj, u)) {
+ units.push({ unit: u, priority: priorities[u] });
+ }
+ }
+ units.sort(function (a, b) {
+ return a.priority - b.priority;
+ });
+ return units;
+}