Gathering detailed insights and metrics for sugar-sorting
Gathering detailed insights and metrics for sugar-sorting
Gathering detailed insights and metrics for sugar-sorting
Gathering detailed insights and metrics for sugar-sorting
npm install sugar-sorting
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
GPL-2.0 License
2 Stars
71 Commits
4 Watchers
3 Branches
3 Contributors
Updated on Jun 05, 2018
Latest Version
0.0.7
Package Id
sugar-sorting@0.0.7
Size
10.46 kB
NPM Version
2.14.2
Node Version
4.0.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Sorting made sweet.
Sugar-sorting is a NPM Module for sorting arrays. It's main goal is to provide a simple sorting API and many different sorting methods for the user to choose from. Sugar-sorting can make it easy for you to sort simple arrays and arrays of objects.
The first thing you should do is install the sugar-sorting module.
1$ npm install -g sugar-sorting
Now you can use require()
to assign this module to a variable and start calling the module's methods.
1var Sorter = require('sugar-sorting'); 2 3var simpleArray = [2, 4, 6, 3, 1, 5]; 4var sorter = new Sorter(simpleArray); 5 6console.log(sorter.bubbleSort()); 7// --> [1, 2, 3, 4, 5, 6]
Sugar-sorting also makes it easier for you to sort your arrays of objects by any property you want to. You just need to call the sortBy('.propertyPath')
method.
1var Sorter = require('sugar-sorting'); 2 3var students = [{ 4 name: 'Stanley Kubrick', 5 age: 50, 6 grades: { 7 highestGrade: 10, 8 lowestGrade: 8 9 } 10 }, { 11 name: 'Christopher Nolan', 12 age: 31, 13 grades: { 14 highestGrade: 8.5, 15 lowestGrade: 6 16 } 17 }, { 18 name: 'Michael Bay', 19 age: 37, 20 grades: { 21 highestGrade: 2, 22 lowestGrade: 0 23 } 24 }]; 25 26var studentsSorter = new Sorter(students); 27 28var studentsByAge = studentsSorter.sortBy('.age').insertionSort(); 29var studentsByHighestGrade = studentsSorter.sortBy('.grades.highestGrade').bubbleSort();
These are the sorting methods on sugar-sorting. The ones marked with an X are the ones available for use.
If you want to learn more about sorting algorithms and the best and worst case scenarios for each one, you can check these amazing links:
When using sugar-sorting, imagine the Sorter object as a magic box in which you put in your array and then tell the box the way you want it to be sorted. After telling the box what you want it will sort your array. Now all you need to do is get the new sorted array from inside the box.
These are some basic steps to follow:
var sorter = new Sorter(yourArray)
or sorter.fillWith(yourArray)
sorter.sortBy('.salary').heapSort()
sorter.getElements()
You can contribute to sugar-sorting by writing tests, improving our algorithms or even creating new ones. Any improvement on the project's docs are welcome too!
To start developing just clone this repository and run the npm install
command on your terminal to download all the dev-dependencies.
If you find any bug or have any suggestion please tell us using our Issue Tracker.
After changing any line of code please run tests using npm test
or grunt
.
Use it as you want to. No worries.
MIT © Lucas Fernandes da Costa
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/15 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More