You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

sort-array

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sort-array - npm Package Compare versions

Comparing version

to
5.1.0

dist/index.mjs

@@ -22,2 +22,3 @@ import arrayify from 'array-back'

* @param {number} [options.undefinedRank] - Configures whether `undefined` values will be sorted before or after defined values. Set to `-1` for before, `1` for after. Defaults to `1`.
* @param {number} [options.nanRank] - Configures whether `NaN` values will be sorted before or after defined values. Set to `-1` for before, `1` for after. Defaults to `1`.
* @returns {Array} Returns the array that was passed in.

@@ -83,2 +84,4 @@ * @alias module:sort-array

result = options.undefinedRank
} else if (Number.isNaN(x) && t.isDefinedValue(y)) {
result = options.nanRank
} else if (t.isNull(y) && t.isDefinedValue(x)) {

@@ -88,2 +91,4 @@ result = -options.nullRank

result = -options.undefinedRank
} else if (Number.isNaN(y) && t.isDefinedValue(x)) {
result = -options.nanRank
} else {

@@ -90,0 +95,0 @@ result = x < y ? -1 : x > y ? 1 : 0

11

package.json
{
"name": "sort-array",
"author": "Lloyd Brookes <75pound@gmail.com>",
"version": "5.0.0",
"version": "5.1.0",
"description": "Isomorphic, load-anywhere function to sort an array by scalar, deep or computed values in any standard or custom order",
"repository": "https://github.com/75lb/sort-array",
"repository": {
"type": "git",
"url": "git+https://github.com/75lb/sort-array.git"
},
"license": "MIT",

@@ -29,4 +32,4 @@ "type": "module",

"test:ci": "75lb-nature test-runner test/defaults.js test/sort-computed-property.js test/sort-custom-order.js test/sort-falsy.js test/sort-primitives.js test/sort-small.js test/sort.js test/validation.js",
"docs": "75lb-nature jsdoc2md -c jsdoc.conf -t README.hbs index.js -d 3 > README.md",
"dist": "75lb-nature cjs-build index.js"
"docs": "75lb-nature jsdoc2md -t README.hbs index.js -d 3 > README.md",
"dist": "75lb-nature cjs-build index.js && 75lb-nature simple-rollup index.js"
},

@@ -33,0 +36,0 @@ "dependencies": {

@@ -196,2 +196,3 @@ [![view on npm](https://badgen.net/npm/v/sort-array)](https://www.npmjs.org/package/sort-array)

| [options.undefinedRank] | <code>number</code> | Configures whether `undefined` values will be sorted before or after defined values. Set to `-1` for before, `1` for after. Defaults to `1`. |
| [options.nanRank] | <code>number</code> | Configures whether `NaN` values will be sorted before or after defined values. Set to `-1` for before, `1` for after. Defaults to `1`. |

@@ -203,3 +204,3 @@

Node.js:
Node.js CommonJS:

@@ -210,3 +211,3 @@ ```js

Within Node.js with ECMAScript Module support enabled:
Node.js ECMAScript:

@@ -223,12 +224,6 @@ ```js

Old browser (adds `window.sortArray`):
```html
<script nomodule src="./node_modules/sort-array/dist/index.js"></script>
```
* * *
&copy; 2015-24 Lloyd Brookes \<75pound@gmail.com\>.
&copy; 2015-25 Lloyd Brookes \<75pound@gmail.com\>.
Tested by [test-runner](https://github.com/test-runner-js/test-runner). Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet