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

fast-sort

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-sort - npm Package Compare versions

Comparing version 3.3.3 to 3.4.0

4

CHANGELOG.md

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

## [3.3.3] - 2023-04-15
Fix usage in TS environment with `"moduleResolution": "node16"`
## [3.3.0] - 2023-04-14

@@ -10,0 +14,0 @@

11

dist/sort.cjs.js

@@ -83,6 +83,6 @@ 'use strict';

var comparer = castComparer(opts.comparer);
return function (_ctx) {
var ctx = Array.isArray(_ctx) && !opts.inPlaceSorting
? _ctx.slice()
: _ctx;
return function (arrayToSort) {
var ctx = Array.isArray(arrayToSort) && !opts.inPlaceSorting
? arrayToSort.slice()
: arrayToSort;
return {

@@ -106,2 +106,5 @@ asc: function (sortBy) {

return -order;
if (typeof a !== typeof b) {
return typeof a < typeof b ? -1 : 1;
}
if (a < b)

@@ -108,0 +111,0 @@ return -1;

@@ -56,7 +56,7 @@ declare type IOrder = 1 | -1;

inPlaceSorting?: false;
}): <T>(_ctx: readonly T[]) => IFastSort<T>;
export declare function createNewSortInstance(opts: ISortInstanceOptions): <T>(_ctx: T[]) => IFastSort<T>;
}): <T>(arrayToSort: readonly T[]) => IFastSort<T>;
export declare function createNewSortInstance(opts: ISortInstanceOptions): <T>(arrayToSort: T[]) => IFastSort<T>;
export declare const defaultComparer: (a: any, b: any, order: any) => number;
export declare const sort: <T>(_ctx: readonly T[]) => IFastSort<T>;
export declare const inPlaceSort: <T>(_ctx: T[]) => IFastSort<T>;
export declare const sort: <T>(arrayToSort: readonly T[]) => IFastSort<T>;
export declare const inPlaceSort: <T>(arrayToSort: T[]) => IFastSort<T>;
export {};

@@ -85,6 +85,6 @@ (function (global, factory) {

var comparer = castComparer(opts.comparer);
return function (_ctx) {
var ctx = Array.isArray(_ctx) && !opts.inPlaceSorting
? _ctx.slice()
: _ctx;
return function (arrayToSort) {
var ctx = Array.isArray(arrayToSort) && !opts.inPlaceSorting
? arrayToSort.slice()
: arrayToSort;
return {

@@ -108,2 +108,5 @@ asc: function (sortBy) {

return -order;
if (typeof a !== typeof b) {
return typeof a < typeof b ? -1 : 1;
}
if (a < b)

@@ -110,0 +113,0 @@ return -1;

@@ -56,7 +56,7 @@ declare type IOrder = 1 | -1;

inPlaceSorting?: false;
}): <T>(_ctx: readonly T[]) => IFastSort<T>;
export declare function createNewSortInstance(opts: ISortInstanceOptions): <T>(_ctx: T[]) => IFastSort<T>;
}): <T>(arrayToSort: readonly T[]) => IFastSort<T>;
export declare function createNewSortInstance(opts: ISortInstanceOptions): <T>(arrayToSort: T[]) => IFastSort<T>;
export declare const defaultComparer: (a: any, b: any, order: any) => number;
export declare const sort: <T>(_ctx: readonly T[]) => IFastSort<T>;
export declare const inPlaceSort: <T>(_ctx: T[]) => IFastSort<T>;
export declare const sort: <T>(arrayToSort: readonly T[]) => IFastSort<T>;
export declare const inPlaceSort: <T>(arrayToSort: T[]) => IFastSort<T>;
export {};

@@ -1,1 +0,1 @@

!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((r="undefined"!=typeof globalThis?globalThis:r||self).fastSort={})}(this,function(r){"use strict";function u(t){return function(r,n,e){return t(r,n,e)*e}}var c=function(r,n){if(r)throw Error("Invalid sort config: "+n)},d=function(r){var n=r||{},e=n.asc,t=n.desc,o=e?1:-1,i=e||t;return c(!i,"Expected `asc` or `desc` property"),c(e&&t,"Ambiguous object with `asc` and `desc` config properties"),{order:o,sortBy:i,comparer:r.comparer&&u(r.comparer)}},f=function(p){return function r(n,e,t,o,i,u,c){var f,a;if("string"==typeof n)f=u[n],a=c[n];else{if("function"!=typeof n){var s=d(n);return r(s.sortBy,e,t,s.order,s.comparer||p,u,c)}f=n(u),a=n(c)}var l=i(f,a,o);return(0===l||null==f&&null==a)&&e.length>t?r(e[t],e,t+1,o,i,u,c):l}};function o(r,n,e,t){return Array.isArray(n)?(Array.isArray(e)&&e.length<2&&(e=e[0]),n.sort(function r(e,t,o){if(void 0===e||!0===e)return function(r,n){return t(r,n,o)};if("string"==typeof e)return c(e.includes("."),"String syntax not allowed for nested properties."),function(r,n){return t(r[e],n[e],o)};if("function"==typeof e)return function(r,n){return t(e(r),e(n),o)};if(Array.isArray(e)){var i=f(t);return function(r,n){return i(e[0],e,1,o,t,r,n)}}var n=d(e);return r(n.sortBy,n.comparer||t,n.order)}(e,t,r))):n}function n(e){var t=u(e.comparer);return function(r){var n=Array.isArray(r)&&!e.inPlaceSorting?r.slice():r;return{asc:function(r){return o(1,n,r,t)},desc:function(r){return o(-1,n,r,t)},by:function(r){return o(1,n,r,t)}}}}function e(r,n,e){return null==r?e:null==n?-e:r<n?-1:n<r?1:0}var t=n({comparer:e}),i=n({comparer:e,inPlaceSorting:!0});r.createNewSortInstance=n,r.defaultComparer=e,r.inPlaceSort=i,r.sort=t,Object.defineProperty(r,"__esModule",{value:!0})});
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((r="undefined"!=typeof globalThis?globalThis:r||self).fastSort={})}(this,function(r){"use strict";function u(t){return function(r,n,e){return t(r,n,e)*e}}var f=function(r,n){if(r)throw Error("Invalid sort config: "+n)},y=function(r){var n=r||{},e=n.asc,t=n.desc,o=e?1:-1,i=e||t;return f(!i,"Expected `asc` or `desc` property"),f(e&&t,"Ambiguous object with `asc` and `desc` config properties"),{order:o,sortBy:i,comparer:r.comparer&&u(r.comparer)}},c=function(l){return function r(n,e,t,o,i,u,f){var c,a;if("string"==typeof n)c=u[n],a=f[n];else{if("function"!=typeof n){var s=y(n);return r(s.sortBy,e,t,s.order,s.comparer||l,u,f)}c=n(u),a=n(f)}var p=i(c,a,o);return(0===p||null==c&&null==a)&&e.length>t?r(e[t],e,t+1,o,i,u,f):p}};function o(r,n,e,t){return Array.isArray(n)?(Array.isArray(e)&&e.length<2&&(e=e[0]),n.sort(function r(e,t,o){if(void 0===e||!0===e)return function(r,n){return t(r,n,o)};if("string"==typeof e)return f(e.includes("."),"String syntax not allowed for nested properties."),function(r,n){return t(r[e],n[e],o)};if("function"==typeof e)return function(r,n){return t(e(r),e(n),o)};if(Array.isArray(e)){var i=c(t);return function(r,n){return i(e[0],e,1,o,t,r,n)}}var n=y(e);return r(n.sortBy,n.comparer||t,n.order)}(e,t,r))):n}function n(e){var t=u(e.comparer);return function(r){var n=Array.isArray(r)&&!e.inPlaceSorting?r.slice():r;return{asc:function(r){return o(1,n,r,t)},desc:function(r){return o(-1,n,r,t)},by:function(r){return o(1,n,r,t)}}}}function e(r,n,e){return null==r?e:null==n?-e:typeof r!=typeof n?typeof r<typeof n?-1:1:r<n?-1:n<r?1:0}var t=n({comparer:e}),i=n({comparer:e,inPlaceSorting:!0});r.createNewSortInstance=n,r.defaultComparer=e,r.inPlaceSort=i,r.sort=t,Object.defineProperty(r,"__esModule",{value:!0})});
{
"name": "fast-sort",
"version": "3.3.3",
"version": "3.4.0",
"description": "Fast easy to use and flexible sorting with TypeScript support",

@@ -5,0 +5,0 @@ "author": "Stefan Novakovic <stefan.novakovich@gmail.com>",

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