Socket
Socket
Sign inDemoInstall

array.prototype.tosorted

Package Overview
Dependencies
66
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.3 to 1.1.4

12

CHANGELOG.md

@@ -8,2 +8,14 @@ # Changelog

## [v1.1.4](https://github.com/es-shims/Array.prototype.toSorted/compare/v1.1.3...v1.1.4) - 2024-06-02
### Fixed
- [Refactor] update implementation to match latest spec [`#3`](https://github.com/es-shims/Array.prototype.toSorted/issues/3)
### Commits
- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `hasown`, `tape` [`159d118`](https://github.com/es-shims/Array.prototype.toSorted/commit/159d11848629e0468f9f10a1e36001f937c0c6ea)
- [Deps] update `call-bind`, `es-abstract`, `es-errors` [`7d32e67`](https://github.com/es-shims/Array.prototype.toSorted/commit/7d32e67417f436d5e8a66bf8286b9ead9296c4f1)
- [meta] add missing `engines.node` [`b49466b`](https://github.com/es-shims/Array.prototype.toSorted/commit/b49466b473d116b5a53209491163bfd2c3aa89bc)
## [v1.1.3](https://github.com/es-shims/Array.prototype.toSorted/compare/v1.1.2...v1.1.3) - 2024-02-04

@@ -10,0 +22,0 @@

40

implementation.js
'use strict';
var callBound = require('call-bind/callBound');
var ArrayCreate = require('es-abstract/2024/ArrayCreate');
var CompareArrayElements = require('es-abstract/2024/CompareArrayElements');
var CreateDataPropertyOrThrow = require('es-abstract/2024/CreateDataPropertyOrThrow');
var IsCallable = require('es-abstract/2024/IsCallable');
var LengthOfArrayLike = require('es-abstract/2024/LengthOfArrayLike');
var SortIndexedProperties = require('es-abstract/2024/SortIndexedProperties');
var ToObject = require('es-abstract/2024/ToObject');
var ToString = require('es-abstract/2024/ToString');
var ArrayCreate = require('es-abstract/2023/ArrayCreate');
var CreateDataPropertyOrThrow = require('es-abstract/2023/CreateDataPropertyOrThrow');
var IsCallable = require('es-abstract/2023/IsCallable');
var LengthOfArrayLike = require('es-abstract/2023/LengthOfArrayLike');
var ToObject = require('es-abstract/2023/ToObject');
var ToString = require('es-abstract/2023/ToString');
var $TypeError = require('es-errors/type');
var $sort = callBound('Array.prototype.sort');
module.exports = function toSorted(comparefn) {
if (typeof comparefn !== 'undefined' && !IsCallable(comparefn)) {
throw new $TypeError('`comparefn` must be a function');
throw new $TypeError('`comparefn` must be a function'); // step 1
}

@@ -24,11 +22,17 @@

var A = ArrayCreate(len); // step 4
var j = 0;
while (j < len) { // steps 5-7, 9-10
CreateDataPropertyOrThrow(A, ToString(j), O[j]);
j += 1;
// eslint-disable-next-line no-sequences
var SortCompare = (0, function (x, y) { // step 5
return CompareArrayElements(x, y, comparefn); // step 5.a
});
var sortedList = SortIndexedProperties(O, len, SortCompare, 'read-through-holes'); // step 6
var j = 0; // step 7
while (j < len) { // step 8
CreateDataPropertyOrThrow(A, ToString(j), sortedList[j]); // step 8.a
j += 1; // step 8.b
}
$sort(A, comparefn); // step 8
return A; // step 11
return A; // step 9
};
{
"name": "array.prototype.tosorted",
"version": "1.1.3",
"version": "1.1.4",
"description": "An ESnext spec-compliant `Array.prototype.toSorted` shim/polyfill/replacement that works as far down as ES3.",

@@ -49,11 +49,11 @@ "main": "index.js",

"dependencies": {
"call-bind": "^1.0.5",
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
"es-abstract": "^1.22.3",
"es-errors": "^1.1.0",
"es-abstract": "^1.23.3",
"es-errors": "^1.3.0",
"es-shim-unscopables": "^1.0.2"
},
"devDependencies": {
"@es-shims/api": "^2.4.2",
"@ljharb/eslint-config": "^21.1.0",
"@es-shims/api": "^2.5.0",
"@ljharb/eslint-config": "^21.1.1",
"aud": "^2.0.4",

@@ -65,3 +65,3 @@ "auto-changelog": "^2.4.0",

"has-strict-mode": "^1.0.1",
"hasown": "^2.0.0",
"hasown": "^2.0.2",
"in-publish": "^2.0.1",

@@ -71,3 +71,3 @@ "npmignore": "^0.3.1",

"safe-publish-latest": "^2.0.0",
"tape": "^5.7.4"
"tape": "^5.7.5"
},

@@ -86,3 +86,6 @@ "auto-changelog": {

]
},
"engines": {
"node": ">= 0.4"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc