rfc6902-ordered
Advanced tools
Comparing version 4.0.3 to 4.0.4
{ | ||
"name": "rfc6902-ordered", | ||
"version": "4.0.3", | ||
"version": "4.0.4", | ||
"description": "https://github.com/chbrown/rfc6902 plus object key ordering", | ||
@@ -5,0 +5,0 @@ "main": "src", |
@@ -55,2 +55,21 @@ 'use strict'; | ||
// if the nearest matching keys are still above and below accordingly, skip | ||
let upIndexInMy = -1; | ||
let downIndexInMy = -1; | ||
for (let upToKey of toKeys.slice(0, indexInTo).reverse()) { | ||
upIndexInMy = myKeys.indexOf(upToKey); | ||
if (upIndexInMy !== -1) { | ||
break; | ||
} | ||
} | ||
for (let downToKey of toKeys.slice(indexInTo + 1)) { | ||
downIndexInMy = myKeys.indexOf(downToKey); | ||
if (downIndexInMy !== -1) { | ||
break; | ||
} | ||
} | ||
if ((upIndexInMy === -1 || upIndexInMy < indexInMy) && (downIndexInMy === -1 || downIndexInMy > indexInMy)) { | ||
continue; | ||
} | ||
let value = myPackageJson[key]; | ||
@@ -57,0 +76,0 @@ |
9372
179