Skip to content

hajtuJ/sort-position-of-dot-separated-numbers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test

Before testing install dependencies npm i or yarn.

Run tests npm run test or yarn test

Explanation

How returned value of sort() implementation works:

Return value sort order
> 0 sort a after b
< 0 sort a before b
=== 0 keep original order of a and b

So, the compare function has the following form:

function compareFn(a, b) {
  if (a is less than b by some ordering criterion) {
    return -1;
  }
  if (a is greater than b by the ordering criterion) {
    return 1;
  }
  // a must be equal to b
  return 0;
}

About

sort strings with dot separated numbers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published