MCPcopy Create free account
hub / github.com/hoothin/UserScripts / compare

Function compare

True URL downloads/manageLinks.js:24–39  ·  view source on GitHub ↗
(o, p, name)

Source from the content-addressed store, hash-verified

22
23var by = function(byName, secName) {
24 var compare = function(o, p, name) {
25 var a, b;
26 if (typeof o === "object" && typeof p === "object" && o && p) {
27 a = o[name];
28 b = p[name];
29 if (a === b) {
30 return 0;
31 }
32 if (typeof a === typeof b) {
33 return a < b ? -1 : 1;
34 }
35 return typeof a < typeof b ? -1 : 1;
36 } else {
37 throw("error");
38 }
39 }
40 return function(o, p) {
41 var result = compare(o, p, byName);
42 if (secName && result == 0) {

Callers 1

byFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected