arrangekeys
Advanced tools
Comparing version 3.0.1 to 4.0.0-next.1585173028.e95525f9e6d60d7f28357fdf62596b07f727c6f7
@@ -9,26 +9,25 @@ /** | ||
export default function arrangeKeys(subject, keys, sort) { | ||
// Prepare | ||
const result = {}; | ||
// Expand | ||
if (!keys) { | ||
sort = true; | ||
} | ||
else { | ||
if (typeof keys === 'string') { | ||
keys = keys.split(/\s+/); | ||
} | ||
// Add the specified keys in the specified order | ||
for (const key of keys) { | ||
if (typeof subject[key] !== 'undefined') { | ||
result[key] = subject[key]; | ||
} | ||
} | ||
} | ||
// Add the leftovers | ||
const dataKeys = sort ? Object.keys(subject).sort() : Object.keys(subject); | ||
for (const key of dataKeys) { | ||
result[key] = subject[key]; // no need for !(key in keys) as we assume the JS engine handles that for us | ||
} | ||
// Return the result | ||
return result; | ||
// Prepare | ||
const result = {} | ||
// Expand | ||
if (!keys) { | ||
sort = true | ||
} else { | ||
if (typeof keys === 'string') { | ||
keys = keys.split(/\s+/) | ||
} | ||
// Add the specified keys in the specified order | ||
for (const key of keys) { | ||
if (typeof subject[key] !== 'undefined') { | ||
result[key] = subject[key] | ||
} | ||
} | ||
} | ||
// Add the leftovers | ||
const dataKeys = sort ? Object.keys(subject).sort() : Object.keys(subject) | ||
for (const key of dataKeys) { | ||
result[key] = subject[key] // no need for !(key in keys) as we assume the JS engine handles that for us | ||
} | ||
// Return the result | ||
return result | ||
} |
@@ -1,3 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict' | ||
Object.defineProperty(exports, '__esModule', { value: true }) | ||
/** | ||
@@ -11,27 +11,26 @@ * Returns a copy of a JavaScript object with the keys arranged in a specified order. | ||
function arrangeKeys(subject, keys, sort) { | ||
// Prepare | ||
const result = {}; | ||
// Expand | ||
if (!keys) { | ||
sort = true; | ||
} | ||
else { | ||
if (typeof keys === 'string') { | ||
keys = keys.split(/\s+/); | ||
} | ||
// Add the specified keys in the specified order | ||
for (const key of keys) { | ||
if (typeof subject[key] !== 'undefined') { | ||
result[key] = subject[key]; | ||
} | ||
} | ||
} | ||
// Add the leftovers | ||
const dataKeys = sort ? Object.keys(subject).sort() : Object.keys(subject); | ||
for (const key of dataKeys) { | ||
result[key] = subject[key]; // no need for !(key in keys) as we assume the JS engine handles that for us | ||
} | ||
// Return the result | ||
return result; | ||
// Prepare | ||
const result = {} | ||
// Expand | ||
if (!keys) { | ||
sort = true | ||
} else { | ||
if (typeof keys === 'string') { | ||
keys = keys.split(/\s+/) | ||
} | ||
// Add the specified keys in the specified order | ||
for (const key of keys) { | ||
if (typeof subject[key] !== 'undefined') { | ||
result[key] = subject[key] | ||
} | ||
} | ||
} | ||
// Add the leftovers | ||
const dataKeys = sort ? Object.keys(subject).sort() : Object.keys(subject) | ||
for (const key of dataKeys) { | ||
result[key] = subject[key] // no need for !(key in keys) as we assume the JS engine handles that for us | ||
} | ||
// Return the result | ||
return result | ||
} | ||
exports.default = arrangeKeys; | ||
exports.default = arrangeKeys |
# History | ||
## v4.0.0 2020 March 26 | ||
- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation) | ||
- Minimum required node version changed from `node: >=8` to `node: >=10` to keep up with mandatory ecosystem changes | ||
## v3.0.1 2019 December 18 | ||
@@ -4,0 +9,0 @@ |
{ | ||
"title": "Arrange Keys", | ||
"name": "arrangekeys", | ||
"version": "3.0.1", | ||
"version": "4.0.0-next.1585173028.e95525f9e6d60d7f28357fdf62596b07f727c6f7", | ||
"description": "Returns a copy of a JavaScript object with the keys arranged in a specified order. Useful for formatting JSON files.", | ||
@@ -66,3 +66,3 @@ "homepage": "https://github.com/bevry/arrangekeys", | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=10" | ||
}, | ||
@@ -103,3 +103,3 @@ "editions": [ | ||
"engines": { | ||
"node": "8 || 10 || 12 || 13", | ||
"node": "10 || 12", | ||
"browsers": false | ||
@@ -115,16 +115,16 @@ } | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^2.12.0", | ||
"@typescript-eslint/parser": "^2.12.0", | ||
"@typescript-eslint/eslint-plugin": "^2.25.0", | ||
"@typescript-eslint/parser": "^2.25.0", | ||
"assert-helpers": "^5.8.0", | ||
"eslint": "^6.7.2", | ||
"eslint": "^6.8.0", | ||
"eslint-config-bevry": "^2.3.0", | ||
"eslint-config-prettier": "^6.7.0", | ||
"eslint-config-prettier": "^6.10.1", | ||
"eslint-plugin-babel": "^5.3.0", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"kava": "^4.4.0", | ||
"prettier": "^1.19.1", | ||
"prettier": "^2.0.2", | ||
"projectz": "^1.19.0", | ||
"surge": "^0.21.3", | ||
"typedoc": "^0.15.5", | ||
"typescript": "^3.7.3", | ||
"typedoc": "^0.17.3", | ||
"typescript": "^3.8.3", | ||
"valid-directory": "^1.6.0", | ||
@@ -156,3 +156,3 @@ "valid-module": "^1.0.0" | ||
"our:verify:module": "valid-module", | ||
"our:verify:prettier": "prettier --write ./source/**", | ||
"our:verify:prettier": "prettier --write .", | ||
"our:verify:typescript": "tsc --noEmit --project tsconfig.json", | ||
@@ -159,0 +159,0 @@ "test": "node ./edition-esnext/test.js" |
@@ -38,2 +38,4 @@ <!-- TITLE/ --> | ||
[Complete API Documentation.](http://master.arrangekeys.bevry.surge.sh/docs/globals.html) | ||
```javascript | ||
@@ -49,3 +51,3 @@ import arrangeKeys from 'arrangekeys' | ||
b: 3, | ||
c: 4 | ||
c: 4, | ||
}, | ||
@@ -68,3 +70,3 @@ 'b c' | ||
b: 3, | ||
c: 4 | ||
c: 4, | ||
}, | ||
@@ -87,3 +89,3 @@ 'b c', | ||
b: 3, | ||
c: 4 | ||
c: 4, | ||
}) | ||
@@ -98,4 +100,2 @@ ) /* { | ||
[Complete API Documentation.](http://master.arrangekeys.bevry.surge.sh/docs/) | ||
<!-- INSTALL/ --> | ||
@@ -116,3 +116,3 @@ | ||
<script type="module"> | ||
import pkg from '//cdn.pika.dev/arrangekeys/^3.0.1' | ||
import pkg from '//cdn.pika.dev/arrangekeys/^4.0.0' | ||
</script> | ||
@@ -125,3 +125,3 @@ ``` | ||
<script type="module"> | ||
import pkg from '//unpkg.com/arrangekeys@^3.0.1' | ||
import pkg from '//unpkg.com/arrangekeys@^4.0.0' | ||
</script> | ||
@@ -134,3 +134,3 @@ ``` | ||
<script type="module"> | ||
import pkg from '//dev.jspm.io/arrangekeys@3.0.1' | ||
import pkg from '//dev.jspm.io/arrangekeys@4.0.0' | ||
</script> | ||
@@ -177,3 +177,3 @@ ``` | ||
<ul><li><a href="http://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/arrangekeys/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/arrangekeys">view contributions</a></li></ul> | ||
<ul><li><a href="http://balupton.com">Benjamin Lupton</a></li></ul> | ||
@@ -198,4 +198,3 @@ <h3>Sponsors</h3> | ||
<ul><li><a href="http://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/arrangekeys/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/arrangekeys">view contributions</a></li> | ||
<li><a href="http://github.com/apps/dependabot-preview">dependabot-preview[bot]</a> — <a href="https://github.com/bevry/arrangekeys/commits?author=dependabot-preview[bot]" title="View the GitHub contributions of dependabot-preview[bot] on repository bevry/arrangekeys">view contributions</a></li></ul> | ||
<ul><li><a href="http://balupton.com">Benjamin Lupton</a></li></ul> | ||
@@ -202,0 +201,0 @@ <a href="https://github.com/bevry/arrangekeys/blob/master/CONTRIBUTING.md#files">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a> |
@@ -11,5 +11,3 @@ { | ||
}, | ||
"include": [ | ||
"source" | ||
] | ||
"include": ["source"] | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
24672
117
1
209