aboutsummaryrefslogtreecommitdiff
path: root/node_modules/es5-ext/object/compare.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
commitcc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch)
tree92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/es5-ext/object/compare.js
parent3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff)
remove node_modules
Diffstat (limited to 'node_modules/es5-ext/object/compare.js')
-rw-r--r--node_modules/es5-ext/object/compare.js45
1 files changed, 0 insertions, 45 deletions
diff --git a/node_modules/es5-ext/object/compare.js b/node_modules/es5-ext/object/compare.js
deleted file mode 100644
index 8d0785890..000000000
--- a/node_modules/es5-ext/object/compare.js
+++ /dev/null
@@ -1,45 +0,0 @@
-"use strict";
-
-var strCompare = require("../string/#/case-insensitive-compare")
- , isObject = require("./is-object")
- , isValue = require("./is-value")
- , numIsNaN = require("../number/is-nan")
- , resolve
- , typeMap;
-
-typeMap = {
- undefined: 0,
- object: 1,
- boolean: 2,
- string: 3,
- number: 4
-};
-
-resolve = function (a) {
- if (isObject(a)) {
- if (typeof a.valueOf !== "function") return NaN;
- a = a.valueOf();
- if (isObject(a)) {
- if (typeof a.toString !== "function") return NaN;
- a = a.toString();
- if (typeof a !== "string") return NaN;
- }
- }
- return a;
-};
-
-module.exports = function (val1, val2) {
- if (val1 === val2) return 0; // Same
-
- val1 = resolve(val1);
- val2 = resolve(val2);
- // eslint-disable-next-line eqeqeq
- if (val1 == val2) return typeMap[typeof val1] - typeMap[typeof val2];
- if (!isValue(val1)) return -1;
- if (!isValue(val2)) return 1;
- if (typeof val1 === "string" || typeof val2 === "string") {
- return strCompare.call(val1, val2);
- }
- if (numIsNaN(val1) && numIsNaN(val2)) return 0; // Jslint: ignore
- return Number(val1) - Number(val2);
-};