5.6.119 • Published 11 months ago

@erboladaiorg/explicabo-eius-adipisci v5.6.119

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@erboladaiorg/explicabo-eius-adipisci

License: MIT Build Version Known Vulnerabilities GitHub last commit (branch) npm npm total codecov

Blazing fast, tree-shakeable, type-safe, modern utility library to sort any type of array

Docs : https://@erboladaiorg/explicabo-eius-adipisci.netlify.com/

Getting started

installation

The library is available as a npm package. To install the package, run:

npm install @erboladaiorg/explicabo-eius-adipisci
# or
yarn add @erboladaiorg/explicabo-eius-adipisci

Start using:

import {byString} from '@erboladaiorg/explicabo-eius-adipisci'

const unsorted = ["xxx", "bbbb", "zzz", "cccc", "aaa"];
const sorted = unsorted.sort(byString());

console.log(sorted); //(5) ["aaa", "bbbb", "cccc", "xxx", "zzz"]

Use directly in the browser

<script src='https://cdn.jsdelivr.net/npm/@erboladaiorg/explicabo-eius-adipisci/dist/index.umd.js'></script>
<script>
  const unsorted = ["xxx", "bbbb", "zzz", "cccc", "aaa"];
  const sorted = unsorted.sort(sort.byString());

  console.log(sorted); //(5) ["aaa", "bbbb", "cccc", "xxx", "zzz"]
</script>

//or via browser modules

<script type='module'>
  import {byString} from 'https://cdn.jsdelivr.net/npm/@erboladaiorg/explicabo-eius-adipisci/dist/index.mjs'

  const unsorted = ["xxx", "bbbb", "zzz", "cccc", "aaa"];
  const sorted = unsorted.sort(byString());

  console.log(sorted); //(5) ["aaa", "bbbb", "cccc", "xxx", "zzz"]
</script>

Some mind-blowing example

sort by a single property

//js or ts file
import {byValue, byNumber, byString} from '@erboladaiorg/explicabo-eius-adipisci'

const arrayUnsorted = [
  {prop: "xxx", foo: 34},
  {prop: "aaa", foo: 325},
  {prop: "zzz", foo: 15},
  {prop: "ccc", foo: 340},
  {prop: "bbb", foo: 0}
];

//this sort by the foo property ascending
const sortedByFoo = arrayUnsorted.sort(byValue((i) => i.foo, byNumber()));
console.log(sortedByFoo); //(5) [{prop: "bbb", foo : 0}, {prop: "zzz", foo: 15}, .....];

//this sort by the prop property descending
const sortedByProp = arrayUnsorted.sort(byValue((i) => i.prop, byString({desc: true})));
console.log(sortedByProp); //(5) [{prop: "zzz", foo : 15}, {prop: "xxx", foo: 34}, .....];

sort by a multiple property

//js or ts file
import {byNumber, byString, byValues} from "@erboladaiorg/explicabo-eius-adipisci";

const objsToSort = [
  {id: 2, name: 'teresa'},
  {id: 3, name: 'roberto'},
  {id: 2, name: 'roberto'}
];

//i sort by THEIR NAMES and THEN by their ids
const sortedObject = objsToSort.sort(byValues([
  [(x) => x.name, byString()],
  [(x) => x.id, byNumber()]
]));

console.log(sortedObject); //[{roberto, 2}, {roberto, 3}, {teresa, 2}];

//i sort by THEIR IDS and THEN by their names
const sortedObject2 = objsToSort.sort(byValues([
  [(x) => x.id, byNumber()],
  [(x) => x.name, byString()]
]));
console.log(sortedObject2); //[{roberto, 2}, {teresa, 2}, {roberto, 3}];

//i sort by THEIR IDS and THEN by their names DESCENDING
const sortedObject3 = objsToSort.sort(byValues([
  [(x) => x.id, byNumber()],
  [(x) => x.name, byString({desc: true})],
]));
console.log(sortedObject3); //[{teresa, 2}, {roberto, 2}, {roberto, 3}];

typescript types check

//ts file
import {byValue, byNumber, byString} from '@erboladaiorg/explicabo-eius-adipisci'

const objsArray = [{numbProp: 2, stringProp: 'a'}, {numbProp: 3, stringProp: 'f'}];

//Incorrect sort property 
const incorrectSortedArray = objsArray.sort(byValue(i => i.numbProp, byString()));
//ts check error : Type 'number' is not assignable to type 'string'.

//Correct sort type
const sortedArray = objsArray.sort(byValue(i => i.numbProp, byNumber()))
//ts check ok

See full Docs

@erboladaiorg/explicabo-eius-adipisci.netlify.com

License

MIT © Cosimo chellini

call-bindgraphqlvisualreactweaksetreact-hook-formrateslottypanionrandomoptionkeypnpm9make dirlesscsses8flatMapES2020valuespipejsonpathES2018groupBygdprshimchannelES2015validationparseloggerRegExp#flagsregular expressionsprunesymbolargumentemitclassnamesformatdeepcopycss lessvaluepropregexstableurlECMAScript 5negative zerojsdiffupshebangstatelessObject.entriesdeepxtermtesterclientstarterfixed-widthgetteres-abstractproxydataregularconcurrencystyleArrayBuffer#slicecloudwatchpatheventsSetcacheECMAScript 2016Array.prototype.flattenRxlimitES7limitedastfull-widthreadablestreamJSON-Schemamkdirbootstrap csslastinstallerttycodescontainsjasminefile systemmodulestelephonermmatchAllreadlazyfolderreplayArray.prototype.findLastIndexaccessibilityoptimizertyped arrayes2016unicodefseventsdropmimesortedrmdirdomhotbusydebuggercommandsideqsterminalreal-timerequestpreserve-symlinksrdsdependency managerreduxsortajvinspectentriesvariables in cssIteratores5toobjectsetImmediateexecregular expressionvalidObject.isECMAScript 2017querylistenersasyncdateflagsfilterbytes3Uint8ClampedArraymonorepologArrayBufferprivate dataestreedebugnumberstreams2ratelimitfunctionindicatordeep-clonerapidFloat32ArraycjkUint16ArrayhookformclassnameartESwatchercryptotoSortedObject.fromEntriessafeio-tsMicrosoftcssrangeerrorlessautoprefixerperformancecallbackECMAScript 2019awesomesaucelanguagenamesfigletsymbolstslibfsencryptionlogging256storagegatewayfunctionsECMAScript 3resolvewgetYAMLprotobufsuperstructstyled-componentsjsonextraFloat64Array_.extendthroatwhichtaptoolseventDispatchernegativemapzodES2016equalityhasOwnPropertykeysframeworkroutinghasOwnsetPrototypeOfES8BigInt64Arrayflaggradients csshooksamazoncurlObjectopenchinesecommanderObservablebufferwalkingless.jslivelockfileoptimistauthargsfastclonemixinsmergetypescriptenvironmentECMAScript 2023BigUint64ArrayextendloadingbreakgroupbddwordwrapinternalES5ES6checkjsdomUnderscoreutilitydotenvArray.prototype.containses2015fast-copygetintrinsicelasticacheequalcss-in-jsbootstrap lessredactlook-uptypeofieimportexportpackageclassesassertionsyntaxerrorbuffersUint32ArrayReactiveExtensionsdataViewconfigsomeapiSymbol.toStringTagkoreanajaxapollojapaneseString.prototype.trimgetPrototypeOfeslintmulti-packagevariablesfiletoolkittoStringTagecmascriptECMAScript 2020structuredClonechaiArray.prototype.flatMapclonestreamses-shim APIRegExp.prototype.flagsaws[[Prototype]]colorstypeerrorcharacterRFC-6455assertdirectorybundlerstylingbeanstalknested csshelpersStreamcompilerclass-validatorimmutabletypesschemaTypedArrayiteratepropertiesloadbalancingeverylinkswfbyteOffseteslint-plugindependenciesreadablerobustroute53eslintconfigseteast-asian-widthfindupStreamscorsvalidateECMAScript 2021widthpackage.jsondeterministicquotelintutilitiesInt16ArrayjsgetOwnPropertyDescriptor-0autoscalinginvariantPushnodejsbundlingrm -rfURLsharedarraybuffernamejwtAsyncIteratorauthenticationcircularfastifydefinefetchfindLastassertscallreducedynamodbcall-boundworkercallboundes2018idfullcss variableefficientInt8ArrayisConcatSpreadablepasswordJSONkinesisutiliterationpackage managercore-jssimpledbwritemomentWeakMapreducerfpsshelltc39globbrowserslistec2predictablemetadataomittrimEndaccessorserializationdayjsgradients css3viewcliesweakmaproutestylesheetemojithrottleURLSearchParamscoercibleprototypedminimalxhrES3lrustatewrapRxJSagentshamES2023es6watchFileECMAScript 6polyfillstdlibmochaduplexbatches-shimscolourescapeprefixcode pointsiambannerrecursivestyleguidecloudtrailbrowserlistfluxremoveReactiveXsliceprettytrimLeftcollection.es6command-lineschemecloudformationmime-dbcomputed-typesextensioncopy@@toStringTagstringifymimetypesfindLastIndexrequiretypea11yimporttrimStartcloudsearchdeleteinglacierwafsuperagentStyleSheetmobilereact-testing-library__proto__fastdefinePropertyparserwalkwritableisparentspersistent.envhashpostcssreact-hookspromisesECMAScript 2018TypeBoxhasjestemrcollectionReflect.getPrototypeOfsyntaxlookansiflatuuidfromvestuninstallpreprocessorsnsgetoptsqsmodulesettingsfullwidthArray.prototype.filterinputtesting$.extendObject.definePropertyerrortoArraycharacterstermponyfillstringifierconsumeless mixinselmcryptsequenceperformanthttpsnativedeepclonephonePromisemruserializematchessymlinkassigncolumnsredux-toolkitMapArray.prototype.findLastHyBieventEmitterruntimesymlinksargparsejoies2017typedarrayscreatehigher-ordergenericsbluebirdArrayESnext0dom-testing-librarysameValueZeroprotocol-bufferses7CSSStyleDeclarationbrowserwarningspecTypeScriptmatchtestsharedarraybufferreusecoremoveObject.keysWebSocketshrinkwrapimmerArrayBuffer.prototype.sliceObject.assigndatastructurepicomatchsearchnopemkdirsES2022watchArray.prototype.flatstylescss nestingfastcopytypedarrayconsoleObject.valuescompile lessfunctionalwaitrm -frformattingUint8ArraytsqueueMicrotaskcomparedeep-copyregexptaskoncepostcss-pluginString.prototype.matchAlli18nconcatcloudfrontjQuerygetECMAScript 2015yupconcatMapenvairbnbsetterstreamiteratorspeedFunction.prototype.nameless compilerconnectjsxCSSidleless cssES2019forEachespreeflattenebsfast-deep-clonenpml10npositivefast-cloneargvparentguidprivatenodeES2017karmabyteLengtharraystraverseArray.prototype.includesconfigurabledescriptioncolumnexpressionhas-owntrimRightqueueform-validationsesownrfc4122packagesfast-deep-copymiddlewarezeroinstallmkdirptddworkflowspinnersenumerablevpcjavascriptwebexpressspinnertypesafehardlinksbindObject.getPrototypeOfincludesarktypecensorpropertyinferencetouchawaitendpointstringcolorformasciitextcallbindintrinsicWebSocketsmapreducemakergbtostringtagquerystringavatakepushoffsetlengthoutputdescriptorsObservablesfinddescriptorlinewrapwordbreakdataviewpluginformschromiumInt32Arrayarraydiff
@erboladaiorg/adipisci-repellendus-corporis@erboladaiorg/adipisci-aspernatur-explicabo@erboladaiorg/alias-iure@erboladaiorg/blanditiis-facere@erboladaiorg/consectetur-incidunt-a@erboladaiorg/cupiditate-ab@erboladaiorg/eligendi-reiciendis-id@erboladaiorg/molestias-omnis-commodi@erboladaiorg/molestias-repellat@erboladaiorg/quibusdam-autem@erboladaiorg/qui-nostrum-quo@erboladaiorg/quibusdam-ipsa@erboladaiorg/quia-maiores@erboladaiorg/reiciendis-inventore@erboladaiorg/vel-culpa@erboladaiorg/vero-fuga@erboladaiorg/ut-excepturi-dolore@erboladaiorg/velit-corporis-maiores@erboladaiorg/velit-adipisci-dicta@erboladaiorg/animi-dignissimos@erboladaiorg/aliquid-quis-voluptates@erboladaiorg/aliquid-rerum-nam@erboladaiorg/id-qui@erboladaiorg/illum-illum@erboladaiorg/impedit-ipsum-natus@erboladaiorg/illo-dolor-ipsam@erboladaiorg/impedit-ratione-quasi@erboladaiorg/laboriosam-inventore-natus@erboladaiorg/natus-harum-voluptatum@erboladaiorg/natus-illo-iste@erboladaiorg/necessitatibus-pariatur-sint@erboladaiorg/odio-libero-mollitia@erboladaiorg/odio-repellendus-doloremque@erboladaiorg/sed-eligendi-accusantium@erboladaiorg/sapiente-molestiae@erboladaiorg/tenetur-magnam@erboladaiorg/tenetur-magni-ab@erboladaiorg/consequuntur-assumenda@erboladaiorg/dolorum-velit@erboladaiorg/et-placeat@erboladaiorg/et-minus@erboladaiorg/iusto-sit-quasi@erboladaiorg/molestiae-voluptatibus@erboladaiorg/nesciunt-quas-saepe@erboladaiorg/possimus-praesentium-sint@erboladaiorg/quidem-molestiae@erboladaiorg/rem-quisquam-quasi@erboladaiorg/tempora-nisi@erboladaiorg/tempora-quas@erboladaiorg/vitae-aut@erboladaiorg/voluptate-alias-voluptate@erboladaiorg/aliquid-quasi@erboladaiorg/aliquid-impedit@erboladaiorg/corporis-error@erboladaiorg/cum-commodi-consequatur@erboladaiorg/cumque-possimus-delectus@erboladaiorg/doloribus-quos-officia@erboladaiorg/error-expedita-alias@erboladaiorg/esse-esse@erboladaiorg/perspiciatis-error-reprehenderit@erboladaiorg/officiis-maiores@erboladaiorg/placeat-natus@erboladaiorg/quaerat-excepturi@erboladaiorg/quod-id@erboladaiorg/tempore-illo@erboladaiorg/temporibus-eligendi@erboladaiorg/voluptatem-eius@erboladaiorg/voluptates-nisi-quibusdam@erboladaiorg/voluptatibus-beatae@erboladaiorg/dignissimos-ducimus-perferendis@erboladaiorg/deserunt-eos-eum@erboladaiorg/deserunt-nobis@erboladaiorg/expedita-accusantium-nisi@erboladaiorg/in-accusamus-architecto@erboladaiorg/incidunt-dicta-magnam@erboladaiorg/nisi-id-consequatur@erboladaiorg/unde-sit@erboladaiorg/ut-dignissimos-laborum@erboladaiorg/distinctio-illum-harum@erboladaiorg/distinctio-provident-voluptatem@erboladaiorg/dolor-pariatur-modi@erboladaiorg/eaque-eaque-saepe@erboladaiorg/ducimus-necessitatibus-omnis@erboladaiorg/ea-saepe@erboladaiorg/itaque-incidunt-quis@erboladaiorg/libero-a@erboladaiorg/libero-possimus@erboladaiorg/magnam-cumque-non@erboladaiorg/porro-laboriosam@erboladaiorg/quas-officiis@erboladaiorg/quam-id-itaque@erboladaiorg/quod-nesciunt-cum@erboladaiorg/totam-mollitia-tenetur@erboladaiorg/asperiores-earum-quaerat@erboladaiorg/assumenda-cupiditate@erboladaiorg/facere-maxime@erboladaiorg/fugiat-deleniti-repudiandae@erboladaiorg/itaque-quo@erboladaiorg/nesciunt-illum-sunt@erboladaiorg/nesciunt-molestiae-quibusdam
5.6.95

12 months ago

5.6.94

12 months ago

5.6.97

12 months ago

5.6.96

12 months ago

5.6.91

12 months ago

5.6.90

12 months ago

5.6.93

12 months ago

5.6.92

12 months ago

4.3.53

1 year ago

4.3.52

1 year ago

4.3.51

1 year ago

4.3.50

1 year ago

4.3.57

1 year ago

4.3.56

1 year ago

4.3.55

1 year ago

4.3.54

1 year ago

4.3.59

1 year ago

4.3.58

1 year ago

5.6.99

12 months ago

5.6.98

12 months ago

3.2.34

1 year ago

5.6.86

1 year ago

3.2.33

1 year ago

4.3.42

1 year ago

4.3.41

1 year ago

4.3.40

1 year ago

4.3.46

1 year ago

4.3.45

1 year ago

4.3.44

1 year ago

4.3.43

1 year ago

4.3.49

1 year ago

4.3.48

1 year ago

4.3.47

1 year ago

5.6.88

1 year ago

5.6.87

1 year ago

5.6.89

12 months ago

4.3.71

1 year ago

4.3.70

1 year ago

4.3.73

1 year ago

4.3.72

1 year ago

4.5.80

1 year ago

4.5.83

1 year ago

4.3.60

1 year ago

4.5.81

1 year ago

4.5.82

1 year ago

4.3.64

1 year ago

4.3.63

1 year ago

4.3.62

1 year ago

4.3.61

1 year ago

4.3.68

1 year ago

4.3.67

1 year ago

4.3.66

1 year ago

4.3.65

1 year ago

4.3.69

1 year ago

5.6.108

12 months ago

5.5.84

1 year ago

3.3.35

1 year ago

5.6.109

11 months ago

5.5.85

1 year ago

3.3.36

1 year ago

3.3.37

1 year ago

5.5.83

1 year ago

3.3.38

1 year ago

3.3.39

1 year ago

5.6.100

12 months ago

5.6.101

12 months ago

5.6.102

12 months ago

5.6.103

12 months ago

5.6.104

12 months ago

5.6.105

12 months ago

5.6.106

12 months ago

5.6.107

12 months ago

3.3.34

1 year ago

2.2.17

1 year ago

2.2.18

1 year ago

2.2.15

1 year ago

2.2.16

1 year ago

2.2.13

1 year ago

2.2.14

1 year ago

5.6.110

11 months ago

5.5.86

1 year ago

5.6.119

11 months ago

5.6.111

11 months ago

5.6.112

11 months ago

5.6.113

11 months ago

5.6.114

11 months ago

5.6.115

11 months ago

5.6.116

11 months ago

5.6.117

11 months ago

2.2.19

1 year ago

5.6.118

11 months ago

2.2.28

1 year ago

2.2.29

1 year ago

2.2.26

1 year ago

2.2.27

1 year ago

2.2.24

1 year ago

2.2.25

1 year ago

2.2.22

1 year ago

2.2.23

1 year ago

2.2.20

1 year ago

2.2.21

1 year ago

4.4.80

1 year ago

2.2.33

1 year ago

4.3.39

1 year ago

2.2.31

1 year ago

2.2.32

1 year ago

2.2.30

1 year ago

4.4.76

1 year ago

4.4.75

1 year ago

4.4.74

1 year ago

4.4.73

1 year ago

4.4.79

1 year ago

4.4.78

1 year ago

4.4.77

1 year ago

2.2.12

1 year ago

2.2.9

1 year ago

2.2.8

1 year ago

2.2.11

1 year ago

2.2.10

1 year ago

2.2.7

1 year ago

2.2.6

1 year ago

2.1.6

1 year ago

2.1.5

1 year ago

2.1.4

1 year ago

2.1.3

1 year ago

2.1.2

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago