use directories for structure
This commit is contained in:
9
node_modules/sortobject/.dependabot/config.yml
generated
vendored
Normal file
9
node_modules/sortobject/.dependabot/config.yml
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
version: 1
|
||||
update_configs:
|
||||
- package_manager: javascript
|
||||
directory: /
|
||||
update_schedule: daily
|
||||
automerged_updates:
|
||||
- match:
|
||||
dependency_type: all
|
||||
update_type: all
|
6
node_modules/sortobject/.github/FUNDING.yml
generated
vendored
Normal file
6
node_modules/sortobject/.github/FUNDING.yml
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
github: [balupton]
|
||||
patreon: bevry
|
||||
open_collective: bevry
|
||||
ko_fi: balupton
|
||||
liberapay: bevry
|
||||
custom: ['https://bevry.me/fund']
|
28
node_modules/sortobject/HISTORY.md
generated
vendored
Normal file
28
node_modules/sortobject/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
# History
|
||||
|
||||
## v1.3.0 2019 November 13
|
||||
|
||||
- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation)
|
||||
|
||||
## v1.2.0 2019 January 1
|
||||
|
||||
- Added JSDoc documentation
|
||||
- Updated [base files](https://github.com/bevry/base) and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation)
|
||||
|
||||
## v1.1.1 2016 May 2
|
||||
|
||||
- Fixed `browser` field
|
||||
|
||||
## v1.1.0 2016 May 2
|
||||
|
||||
- Converted from CoffeeScript to JavaScript
|
||||
- Updated base files
|
||||
|
||||
## v1.0.1 2016 January 27
|
||||
|
||||
- Fixed Firefox compatibility issue - Thanks to [Serge Havas](https://github.com/Sinewyk) for [pull request #2](https://github.com/bevry/sortobject/pull/2)
|
||||
- Updated base files
|
||||
|
||||
## v1.0.0 2013 April 20
|
||||
|
||||
- Initial working version
|
23
node_modules/sortobject/LICENSE.md
generated
vendored
Normal file
23
node_modules/sortobject/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<!-- LICENSEFILE/ -->
|
||||
|
||||
<h1>License</h1>
|
||||
|
||||
Unless stated otherwise all works are:
|
||||
|
||||
<ul><li>Copyright © 2012+ <a href="http://bevry.me">Bevry Pty Ltd</a></li></ul>
|
||||
|
||||
and licensed under:
|
||||
|
||||
<ul><li><a href="http://spdx.org/licenses/MIT.html">MIT License</a></li></ul>
|
||||
|
||||
<h2>MIT License</h2>
|
||||
|
||||
<pre>
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
</pre>
|
||||
|
||||
<!-- /LICENSEFILE -->
|
205
node_modules/sortobject/README.md
generated
vendored
Normal file
205
node_modules/sortobject/README.md
generated
vendored
Normal file
@@ -0,0 +1,205 @@
|
||||
<!-- TITLE/ -->
|
||||
|
||||
<h1>Sort Object</h1>
|
||||
|
||||
<!-- /TITLE -->
|
||||
|
||||
|
||||
<!-- BADGES/ -->
|
||||
|
||||
<span class="badge-travisci"><a href="http://travis-ci.com/bevry/sortobject" title="Check this project's build status on TravisCI"><img src="https://img.shields.io/travis/com/bevry/sortobject/master.svg" alt="Travis CI Build Status" /></a></span>
|
||||
<span class="badge-npmversion"><a href="https://npmjs.org/package/sortobject" title="View this project on NPM"><img src="https://img.shields.io/npm/v/sortobject.svg" alt="NPM version" /></a></span>
|
||||
<span class="badge-npmdownloads"><a href="https://npmjs.org/package/sortobject" title="View this project on NPM"><img src="https://img.shields.io/npm/dm/sortobject.svg" alt="NPM downloads" /></a></span>
|
||||
<span class="badge-daviddm"><a href="https://david-dm.org/bevry/sortobject" title="View the status of this project's dependencies on DavidDM"><img src="https://img.shields.io/david/bevry/sortobject.svg" alt="Dependency Status" /></a></span>
|
||||
<span class="badge-daviddmdev"><a href="https://david-dm.org/bevry/sortobject#info=devDependencies" title="View the status of this project's development dependencies on DavidDM"><img src="https://img.shields.io/david/dev/bevry/sortobject.svg" alt="Dev Dependency Status" /></a></span>
|
||||
<br class="badge-separator" />
|
||||
<span class="badge-patreon"><a href="https://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
|
||||
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span>
|
||||
<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span>
|
||||
<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span>
|
||||
<span class="badge-opencollective"><a href="https://opencollective.com/bevry" title="Donate to this project using Open Collective"><img src="https://img.shields.io/badge/open%20collective-donate-yellow.svg" alt="Open Collective donate button" /></a></span>
|
||||
<span class="badge-crypto"><a href="https://bevry.me/crypto" title="Donate to this project using Cryptocurrency"><img src="https://img.shields.io/badge/crypto-donate-yellow.svg" alt="crypto donate button" /></a></span>
|
||||
<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span>
|
||||
<span class="badge-wishlist"><a href="https://bevry.me/wishlist" title="Buy an item on our wishlist for us"><img src="https://img.shields.io/badge/wishlist-donate-yellow.svg" alt="Wishlist browse button" /></a></span>
|
||||
|
||||
<!-- /BADGES -->
|
||||
|
||||
|
||||
<!-- DESCRIPTION/ -->
|
||||
|
||||
Returns a copy of an object, sorted deeply by its keys, without mangling any arrays inside of it
|
||||
|
||||
<!-- /DESCRIPTION -->
|
||||
|
||||
|
||||
<!-- INSTALL/ -->
|
||||
|
||||
<h2>Install</h2>
|
||||
|
||||
<a href="https://npmjs.com" title="npm is a package manager for javascript"><h3>npm</h3></a>
|
||||
<ul>
|
||||
<li>Install: <code>npm install --save sortobject</code></li>
|
||||
<li>Require: <code>require('sortobject')</code></li>
|
||||
</ul>
|
||||
|
||||
<a href="https://jspm.io" title="Native ES Modules CDN"><h3>jspm</h3></a>
|
||||
|
||||
``` html
|
||||
<script type="module">
|
||||
import * as pkg from '//dev.jspm.io/sortobject'
|
||||
</script>
|
||||
```
|
||||
|
||||
<h3><a href="https://editions.bevry.me" title="Editions are the best way to produce and consume packages you care about.">Editions</a></h3>
|
||||
|
||||
<p>This package is published with the following editions:</p>
|
||||
|
||||
<ul><li><code>sortobject</code> aliases <code>sortobject/index.js</code> which uses <a href="https://editions.bevry.me" title="Editions are the best way to produce and consume packages you care about.">Editions</a> to automatically select the correct edition for the consumers environment</li>
|
||||
<li><code>sortobject/source/index.js</code> is esnext source code with require for modules</li>
|
||||
<li><code>sortobject/edition-browsers/index.js</code> is esnext compiled for browsers with require for modules</li>
|
||||
<li><code>sortobject/edition-node-0.12/index.js</code> is esnext compiled for node.js 0.12 with require for modules</li></ul>
|
||||
|
||||
<h3><a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a></h3>
|
||||
|
||||
This project provides its type information via inline <a href="http://usejsdoc.org" title="JSDoc is an API documentation generator for JavaScript, similar to Javadoc or phpDocumentor">JSDoc Comments</a>. To make use of this in <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a>, set your <code>maxNodeModuleJsDepth</code> compiler option to `5` or thereabouts. You can accomlish this via your `tsconfig.json` file like so:
|
||||
|
||||
``` json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"maxNodeModuleJsDepth": 5
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<!-- /INSTALL -->
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
[API Documentation.](http://master.sortobject.bevry.surge.sh/docs/)
|
||||
|
||||
```javascript
|
||||
var sortObject = require('sortobject')
|
||||
var fixture = {
|
||||
c: true,
|
||||
a: true,
|
||||
b: null,
|
||||
d: [
|
||||
{
|
||||
c: true,
|
||||
a: true,
|
||||
b: null
|
||||
},
|
||||
{
|
||||
c: true,
|
||||
a: true,
|
||||
b: null,
|
||||
d: [
|
||||
{
|
||||
c: true,
|
||||
a: true,
|
||||
b: null
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
var actual = sortObject(fixture)
|
||||
console.log(JSON.stringify(actual, null, 4)) /* {
|
||||
"a": true,
|
||||
"b": null,
|
||||
"c": true,
|
||||
"d": [
|
||||
{
|
||||
"a": true,
|
||||
"b": null,
|
||||
"c": true
|
||||
},
|
||||
{
|
||||
"a": true,
|
||||
"b": null,
|
||||
"c": true,
|
||||
"d": [
|
||||
{
|
||||
"a": true,
|
||||
"b": null,
|
||||
"c": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
} */
|
||||
```
|
||||
|
||||
<!-- HISTORY/ -->
|
||||
|
||||
<h2>History</h2>
|
||||
|
||||
<a href="https://github.com/bevry/sortobject/blob/master/HISTORY.md#files">Discover the release history by heading on over to the <code>HISTORY.md</code> file.</a>
|
||||
|
||||
<!-- /HISTORY -->
|
||||
|
||||
|
||||
<!-- CONTRIBUTE/ -->
|
||||
|
||||
<h2>Contribute</h2>
|
||||
|
||||
<a href="https://github.com/bevry/sortobject/blob/master/CONTRIBUTING.md#files">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a>
|
||||
|
||||
<!-- /CONTRIBUTE -->
|
||||
|
||||
|
||||
<!-- BACKERS/ -->
|
||||
|
||||
<h2>Backers</h2>
|
||||
|
||||
<h3>Maintainers</h3>
|
||||
|
||||
These amazing people are maintaining this project:
|
||||
|
||||
<ul><li><a href="http://balupton.com">Benjamin Lupton</a></li></ul>
|
||||
|
||||
<h3>Sponsors</h3>
|
||||
|
||||
These amazing people have contributed finances to this project:
|
||||
|
||||
<ul><li><a href="http://www.govests.com.au">GoVests</a></li></ul>
|
||||
|
||||
Become a sponsor!
|
||||
|
||||
<span class="badge-patreon"><a href="https://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
|
||||
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span>
|
||||
<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span>
|
||||
<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span>
|
||||
<span class="badge-opencollective"><a href="https://opencollective.com/bevry" title="Donate to this project using Open Collective"><img src="https://img.shields.io/badge/open%20collective-donate-yellow.svg" alt="Open Collective donate button" /></a></span>
|
||||
<span class="badge-crypto"><a href="https://bevry.me/crypto" title="Donate to this project using Cryptocurrency"><img src="https://img.shields.io/badge/crypto-donate-yellow.svg" alt="crypto donate button" /></a></span>
|
||||
<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span>
|
||||
<span class="badge-wishlist"><a href="https://bevry.me/wishlist" title="Buy an item on our wishlist for us"><img src="https://img.shields.io/badge/wishlist-donate-yellow.svg" alt="Wishlist browse button" /></a></span>
|
||||
|
||||
<h3>Contributors</h3>
|
||||
|
||||
These amazing people have contributed code to this project:
|
||||
|
||||
<ul><li><a href="http://balupton.com">Benjamin Lupton</a></li>
|
||||
<li><a href="sinewyk.com">Serge Havas</a></li>
|
||||
<li><a href="http://jameslnewell.me/">James Newell</a></li>
|
||||
<li><a href="http://jameslnewell.dev/">James Newell</a></li></ul>
|
||||
|
||||
<a href="https://github.com/bevry/sortobject/blob/master/CONTRIBUTING.md#files">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a>
|
||||
|
||||
<!-- /BACKERS -->
|
||||
|
||||
|
||||
<!-- LICENSE/ -->
|
||||
|
||||
<h2>License</h2>
|
||||
|
||||
Unless stated otherwise all works are:
|
||||
|
||||
<ul><li>Copyright © 2012+ <a href="http://bevry.me">Bevry Pty Ltd</a></li></ul>
|
||||
|
||||
and licensed under:
|
||||
|
||||
<ul><li><a href="http://spdx.org/licenses/MIT.html">MIT License</a></li></ul>
|
||||
|
||||
<!-- /LICENSE -->
|
59
node_modules/sortobject/edition-browsers/index.js
generated
vendored
Normal file
59
node_modules/sortobject/edition-browsers/index.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
'use strict';
|
||||
/**
|
||||
* A typical comparator for sorting.
|
||||
* @callback Comparator
|
||||
* @param {any} a
|
||||
* @param {any} b
|
||||
* @returns {number}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns a copy of an object, sorted deeply by its keys, without mangling any arrays inside of it.
|
||||
* @param {object} obj The unsorted object.
|
||||
* @param {Comparator} [comparator] An optional comparator to use to sort the keys.
|
||||
* @returns {object} The new sorted object.
|
||||
*/
|
||||
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function sortObject(obj, comparator) {
|
||||
// Arrays
|
||||
if (Array.isArray(obj)) {
|
||||
var result = [];
|
||||
|
||||
for (var i = 0; i < obj.length; ++i) {
|
||||
// Fetch
|
||||
var value = obj[i]; // Recurse if object or array
|
||||
|
||||
if (value != null && _typeof(value) === 'object') {
|
||||
value = sortObject(value, comparator);
|
||||
} // Push
|
||||
|
||||
|
||||
result.push(value);
|
||||
}
|
||||
|
||||
return result;
|
||||
} // Objects
|
||||
else {
|
||||
var _result = {};
|
||||
var sortedKeys = Object.keys(obj).sort(comparator);
|
||||
|
||||
for (var _i = 0; _i < sortedKeys.length; ++_i) {
|
||||
// Fetch
|
||||
var key = sortedKeys[_i];
|
||||
var _value = obj[key]; // Recurse if object or array
|
||||
|
||||
if (_value != null && _typeof(_value) === 'object') {
|
||||
_value = sortObject(_value, comparator);
|
||||
} // Push
|
||||
|
||||
|
||||
_result[key] = _value;
|
||||
}
|
||||
|
||||
return _result;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = sortObject;
|
57
node_modules/sortobject/edition-node-0.12/index.js
generated
vendored
Normal file
57
node_modules/sortobject/edition-node-0.12/index.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
'use strict';
|
||||
/**
|
||||
* A typical comparator for sorting.
|
||||
* @callback Comparator
|
||||
* @param {any} a
|
||||
* @param {any} b
|
||||
* @returns {number}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns a copy of an object, sorted deeply by its keys, without mangling any arrays inside of it.
|
||||
* @param {object} obj The unsorted object.
|
||||
* @param {Comparator} [comparator] An optional comparator to use to sort the keys.
|
||||
* @returns {object} The new sorted object.
|
||||
*/
|
||||
|
||||
function sortObject(obj, comparator) {
|
||||
// Arrays
|
||||
if (Array.isArray(obj)) {
|
||||
var result = [];
|
||||
|
||||
for (var i = 0; i < obj.length; ++i) {
|
||||
// Fetch
|
||||
var value = obj[i]; // Recurse if object or array
|
||||
|
||||
if (value != null && typeof value === 'object') {
|
||||
value = sortObject(value, comparator);
|
||||
} // Push
|
||||
|
||||
|
||||
result.push(value);
|
||||
}
|
||||
|
||||
return result;
|
||||
} // Objects
|
||||
else {
|
||||
var _result = {};
|
||||
var sortedKeys = Object.keys(obj).sort(comparator);
|
||||
|
||||
for (var _i = 0; _i < sortedKeys.length; ++_i) {
|
||||
// Fetch
|
||||
var key = sortedKeys[_i];
|
||||
var _value = obj[key]; // Recurse if object or array
|
||||
|
||||
if (_value != null && typeof _value === 'object') {
|
||||
_value = sortObject(_value, comparator);
|
||||
} // Push
|
||||
|
||||
|
||||
_result[key] = _value;
|
||||
}
|
||||
|
||||
return _result;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = sortObject;
|
4
node_modules/sortobject/index.js
generated
vendored
Normal file
4
node_modules/sortobject/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict'
|
||||
|
||||
/** @type {typeof import("./source/index.js") } */
|
||||
module.exports = require('editions').requirePackage(__dirname, require)
|
257
node_modules/sortobject/package.json
generated
vendored
Normal file
257
node_modules/sortobject/package.json
generated
vendored
Normal file
@@ -0,0 +1,257 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"sortobject@1.3.0",
|
||||
"D:\\Projects\\siag\\vanillajs-seed"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "sortobject@1.3.0",
|
||||
"_id": "sortobject@1.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-rr0RrgE3ZoWaREnHiidnywzXLaeqmxDKfB4Htdbzu4WBzsVeZEJrhz7AR4ZF+gzHgbog/lQoNXxCWHaXeLc1Dg==",
|
||||
"_location": "/sortobject",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "sortobject@1.3.0",
|
||||
"name": "sortobject",
|
||||
"escapedName": "sortobject",
|
||||
"rawSpec": "1.3.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.3.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/i18next-scanner"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/sortobject/-/sortobject-1.3.0.tgz",
|
||||
"_spec": "1.3.0",
|
||||
"_where": "D:\\Projects\\siag\\vanillajs-seed",
|
||||
"author": {
|
||||
"name": "2012+ Bevry Pty Ltd",
|
||||
"email": "us@bevry.me",
|
||||
"url": "http://bevry.me"
|
||||
},
|
||||
"babel": {
|
||||
"env": {
|
||||
"edition-browsers": {
|
||||
"sourceType": "script",
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"targets": "defaults",
|
||||
"modules": "commonjs"
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/proposal-object-rest-spread"
|
||||
]
|
||||
},
|
||||
"edition-node-0.12": {
|
||||
"sourceType": "script",
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"targets": {
|
||||
"node": "0.12"
|
||||
},
|
||||
"modules": "commonjs"
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/proposal-object-rest-spread"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"badges": {
|
||||
"list": [
|
||||
"travisci",
|
||||
"npmversion",
|
||||
"npmdownloads",
|
||||
"daviddm",
|
||||
"daviddmdev",
|
||||
"---",
|
||||
"patreon",
|
||||
"flattr",
|
||||
"liberapay",
|
||||
"buymeacoffee",
|
||||
"opencollective",
|
||||
"crypto",
|
||||
"paypal",
|
||||
"wishlist"
|
||||
],
|
||||
"config": {
|
||||
"buymeacoffeeUsername": "balupton",
|
||||
"cryptoURL": "https://bevry.me/crypto",
|
||||
"flattrUsername": "balupton",
|
||||
"liberapayUsername": "bevry",
|
||||
"opencollectiveUsername": "bevry",
|
||||
"patreonUsername": "bevry",
|
||||
"paypalURL": "https://bevry.me/paypal",
|
||||
"wishlistURL": "https://bevry.me/wishlist",
|
||||
"travisTLD": "com"
|
||||
}
|
||||
},
|
||||
"browser": "edition-browsers/index.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/bevry/sortobject/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Benjamin Lupton",
|
||||
"email": "b@lupton.cc",
|
||||
"url": "http://balupton.com"
|
||||
},
|
||||
{
|
||||
"name": "Serge Havas",
|
||||
"email": "sinewyk@gmail.com",
|
||||
"url": "sinewyk.com"
|
||||
},
|
||||
{
|
||||
"name": "James Newell",
|
||||
"url": "http://jameslnewell.me/"
|
||||
},
|
||||
{
|
||||
"name": "James Newell",
|
||||
"url": "http://jameslnewell.dev/"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"editions": "^2.2.0"
|
||||
},
|
||||
"description": "Returns a copy of an object, sorted deeply by its keys, without mangling any arrays inside of it",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.7.0",
|
||||
"@babel/core": "^7.7.2",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
|
||||
"@babel/preset-env": "^7.7.1",
|
||||
"assert-helpers": "4.10.0",
|
||||
"eslint": "^6.6.0",
|
||||
"eslint-config-bevry": "^1.2.1",
|
||||
"eslint-config-prettier": "^6.5.0",
|
||||
"eslint-plugin-babel": "^5.3.0",
|
||||
"eslint-plugin-prettier": "^3.1.1",
|
||||
"jsdoc": "^3.6.3",
|
||||
"kava": "^3.2.0",
|
||||
"minami": "^1.2.3",
|
||||
"prettier": "^1.19.1",
|
||||
"projectz": "^1.9.0",
|
||||
"surge": "^0.21.3",
|
||||
"valid-directory": "^1.0.0"
|
||||
},
|
||||
"editions": [
|
||||
{
|
||||
"description": "esnext source code with require for modules",
|
||||
"directory": "source",
|
||||
"entry": "index.js",
|
||||
"tags": [
|
||||
"javascript",
|
||||
"esnext",
|
||||
"require"
|
||||
],
|
||||
"engines": {
|
||||
"node": "6 || 8 || 10 || 12 || 13",
|
||||
"browsers": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "esnext compiled for browsers with require for modules",
|
||||
"directory": "edition-browsers",
|
||||
"entry": "index.js",
|
||||
"tags": [
|
||||
"javascript",
|
||||
"require"
|
||||
],
|
||||
"engines": {
|
||||
"node": false,
|
||||
"browsers": "defaults"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "esnext compiled for node.js 0.12 with require for modules",
|
||||
"directory": "edition-node-0.12",
|
||||
"entry": "index.js",
|
||||
"tags": [
|
||||
"javascript",
|
||||
"require"
|
||||
],
|
||||
"engines": {
|
||||
"node": "0.12 || 4 || 6 || 8 || 10 || 12 || 13",
|
||||
"browsers": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"bevry"
|
||||
]
|
||||
},
|
||||
"funding": "https://bevry.me/fund",
|
||||
"homepage": "https://github.com/bevry/sortobject",
|
||||
"keywords": [
|
||||
"sort",
|
||||
"object",
|
||||
"keys",
|
||||
"comparator",
|
||||
"array",
|
||||
"deep",
|
||||
"deeply"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Benjamin Lupton",
|
||||
"email": "b@lupton.cc",
|
||||
"url": "http://balupton.com"
|
||||
}
|
||||
],
|
||||
"name": "sortobject",
|
||||
"prettier": {
|
||||
"semi": false,
|
||||
"singleQuote": true
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/bevry/sortobject.git"
|
||||
},
|
||||
"scripts": {
|
||||
"our:clean": "rm -Rf ./docs ./edition* ./es2015 ./es5 ./out ./.next",
|
||||
"our:compile": "npm run our:compile:edition-browsers && npm run our:compile:edition-node-0.12",
|
||||
"our:compile:edition-browsers": "env BABEL_ENV=edition-browsers babel --out-dir ./edition-browsers ./source",
|
||||
"our:compile:edition-node-0.12": "env BABEL_ENV=edition-node-0.12 babel --out-dir ./edition-node-0.12 ./source",
|
||||
"our:deploy": "echo no need for this project",
|
||||
"our:meta": "npm run our:meta:docs && npm run our:meta:projectz",
|
||||
"our:meta:docs": "npm run our:meta:docs:jsdoc",
|
||||
"our:meta:docs:jsdoc": "rm -Rf ./docs && jsdoc --recurse --pedantic --access all --destination ./docs --package ./package.json --readme ./README.md --template ./node_modules/minami ./source && mv ./docs/$npm_package_name/$npm_package_version/* ./docs/ && rm -Rf ./docs/$npm_package_name/$npm_package_version",
|
||||
"our:meta:projectz": "projectz compile",
|
||||
"our:release": "npm run our:release:prepare && npm run our:release:check-changelog && npm run our:release:check-dirty && npm run our:release:tag && npm run our:release:push",
|
||||
"our:release:check-changelog": "cat ./HISTORY.md | grep v$npm_package_version || (echo add a changelog entry for v$npm_package_version && exit -1)",
|
||||
"our:release:check-dirty": "git diff --exit-code",
|
||||
"our:release:prepare": "npm run our:clean && npm run our:compile && npm run our:test && npm run our:meta",
|
||||
"our:release:push": "git push origin master && git push origin --tags",
|
||||
"our:release:tag": "export MESSAGE=$(cat ./HISTORY.md | sed -n \"/## v$npm_package_version/,/##/p\" | sed 's/## //' | awk 'NR>1{print buf}{buf = $0}') && test \"$MESSAGE\" || (echo 'proper changelog entry not found' && exit -1) && git tag v$npm_package_version -am \"$MESSAGE\"",
|
||||
"our:setup": "npm run our:setup:install",
|
||||
"our:setup:install": "npm install",
|
||||
"our:test": "npm run our:verify && npm test",
|
||||
"our:verify": "npm run our:verify:directory && npm run our:verify:eslint && npm run our:verify:prettier",
|
||||
"our:verify:directory": "npx valid-directory",
|
||||
"our:verify:eslint": "eslint --fix --ignore-pattern '**/*.d.ts' --ignore-pattern '**/vendor/' --ignore-pattern '**/node_modules/' --ext .mjs,.js,.jsx,.ts,.tsx ./source",
|
||||
"our:verify:prettier": "prettier --write ./source/**",
|
||||
"test": "node ./test.js"
|
||||
},
|
||||
"sponsors": [
|
||||
"GoVests <oren@govests.com.au> (https://www.govests.com.au)"
|
||||
],
|
||||
"title": "Sort Object",
|
||||
"version": "1.3.0"
|
||||
}
|
57
node_modules/sortobject/source/index.js
generated
vendored
Normal file
57
node_modules/sortobject/source/index.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* A typical comparator for sorting.
|
||||
* @callback Comparator
|
||||
* @param {any} a
|
||||
* @param {any} b
|
||||
* @returns {number}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns a copy of an object, sorted deeply by its keys, without mangling any arrays inside of it.
|
||||
* @param {object} obj The unsorted object.
|
||||
* @param {Comparator} [comparator] An optional comparator to use to sort the keys.
|
||||
* @returns {object} The new sorted object.
|
||||
*/
|
||||
function sortObject(obj, comparator) {
|
||||
// Arrays
|
||||
if (Array.isArray(obj)) {
|
||||
const result = []
|
||||
for (let i = 0; i < obj.length; ++i) {
|
||||
// Fetch
|
||||
let value = obj[i]
|
||||
|
||||
// Recurse if object or array
|
||||
if (value != null && typeof value === 'object') {
|
||||
value = sortObject(value, comparator)
|
||||
}
|
||||
|
||||
// Push
|
||||
result.push(value)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// Objects
|
||||
else {
|
||||
const result = {}
|
||||
const sortedKeys = Object.keys(obj).sort(comparator)
|
||||
for (let i = 0; i < sortedKeys.length; ++i) {
|
||||
// Fetch
|
||||
const key = sortedKeys[i]
|
||||
let value = obj[key]
|
||||
|
||||
// Recurse if object or array
|
||||
if (value != null && typeof value === 'object') {
|
||||
value = sortObject(value, comparator)
|
||||
}
|
||||
|
||||
// Push
|
||||
result[key] = value
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = sortObject
|
Reference in New Issue
Block a user