Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@discordjs/collection

Package Overview
Dependencies
Maintainers
2
Versions
1204
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@discordjs/collection - npm Package Compare versions

Comparing version 3.0.0-dev.1732925557-f5445c810 to 3.0.0-dev.1733141130-5f0d28c0f

24

dist/index.d.ts

@@ -375,6 +375,7 @@ /**

* The sort method sorts the items of a collection in place and returns it.
* The default sort order is according to string Unicode code points.
* If a comparison function is not provided, the function sorts by element values, using the same stringwise comparison algorithm as
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort | Array.sort()}.
*
* @param compareFunction - Specifies a function that defines the sort order.
* If omitted, the collection is sorted according to each character's Unicode code point value, according to the string conversion of each element.
* @param compareFunction - Specifies a function that defines the sort order. The return value of this function should be negative if
* `a` comes before `b`, positive if `b` comes before `a`, or zero if `a` and `b` are considered equal.
* @example

@@ -481,11 +482,11 @@ * ```ts

/**
* The sorted method sorts the items of a collection and returns it.
* The default sort order is according to string Unicode code points.
* The toSorted method returns a shallow copy of the collection with the items sorted.
* If a comparison function is not provided, the function sorts by element values, using the same stringwise comparison algorithm as
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort | Array.sort()}.
*
* @param compareFunction - Specifies a function that defines the sort order.
* If omitted, the collection is sorted according to each character's Unicode code point value,
* according to the string conversion of each element.
* @param compareFunction - Specifies a function that defines the sort order. The return value of this function should be negative if
* `a` comes before `b`, positive if `b` comes before `a`, or zero if `a` and `b` are considered equal.
* @example
* ```ts
* collection.sorted((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);
* const sortedCollection = collection.toSorted((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);
* ```

@@ -495,2 +496,7 @@ */

toJSON(): [Key, Value][];
/**
* Emulates the default sort comparison algorithm used in ECMAScript. Equivalent to calling the
* {@link https://tc39.es/ecma262/multipage/indexed-collections.html#sec-comparearrayelements | CompareArrayElements}
* operation with arguments `firstValue`, `secondValue` and `undefined`.
*/
private static defaultSort;

@@ -497,0 +503,0 @@ /**

@@ -386,6 +386,7 @@ "use strict";

* The sort method sorts the items of a collection in place and returns it.
* The default sort order is according to string Unicode code points.
* If a comparison function is not provided, the function sorts by element values, using the same stringwise comparison algorithm as
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort | Array.sort()}.
*
* @param compareFunction - Specifies a function that defines the sort order.
* If omitted, the collection is sorted according to each character's Unicode code point value, according to the string conversion of each element.
* @param compareFunction - Specifies a function that defines the sort order. The return value of this function should be negative if
* `a` comes before `b`, positive if `b` comes before `a`, or zero if `a` and `b` are considered equal.
* @example

@@ -549,11 +550,11 @@ * ```ts

/**
* The sorted method sorts the items of a collection and returns it.
* The default sort order is according to string Unicode code points.
* The toSorted method returns a shallow copy of the collection with the items sorted.
* If a comparison function is not provided, the function sorts by element values, using the same stringwise comparison algorithm as
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort | Array.sort()}.
*
* @param compareFunction - Specifies a function that defines the sort order.
* If omitted, the collection is sorted according to each character's Unicode code point value,
* according to the string conversion of each element.
* @param compareFunction - Specifies a function that defines the sort order. The return value of this function should be negative if
* `a` comes before `b`, positive if `b` comes before `a`, or zero if `a` and `b` are considered equal.
* @example
* ```ts
* collection.sorted((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);
* const sortedCollection = collection.toSorted((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);
* ```

@@ -567,4 +568,15 @@ */

}
/**
* Emulates the default sort comparison algorithm used in ECMAScript. Equivalent to calling the
* {@link https://tc39.es/ecma262/multipage/indexed-collections.html#sec-comparearrayelements | CompareArrayElements}
* operation with arguments `firstValue`, `secondValue` and `undefined`.
*/
static defaultSort(firstValue, secondValue) {
return Number(firstValue > secondValue) || Number(firstValue === secondValue) - 1;
if (firstValue === void 0) return secondValue === void 0 ? 0 : 1;
if (secondValue === void 0) return -1;
const x = String(firstValue);
const y = String(secondValue);
if (x < y) return -1;
if (y < x) return 1;
return 0;
}

@@ -596,3 +608,3 @@ /**

// src/index.ts
var version = "3.0.0-dev.1732925557-f5445c810";
var version = "3.0.0-dev.1733141130-5f0d28c0f";
// Annotate the CommonJS export names for ESM import in node:

@@ -599,0 +611,0 @@ 0 && (module.exports = {

{
"$schema": "https://json.schemastore.org/package.json",
"name": "@discordjs/collection",
"version": "3.0.0-dev.1732925557-f5445c810",
"version": "3.0.0-dev.1733141130-5f0d28c0f",
"description": "Utility data structure used in discord.js",

@@ -65,4 +65,4 @@ "exports": {

"vitest": "^2.1.5",
"@discordjs/scripts": "^0.1.0",
"@discordjs/api-extractor": "^7.38.1"
"@discordjs/api-extractor": "^7.38.1",
"@discordjs/scripts": "^0.1.0"
},

@@ -69,0 +69,0 @@ "engines": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc