1.0.5 • Published 4 years ago

@rhtvma/alpha-num-sort v1.0.5

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

##Description The alpha-num-Sort module created to perform correct sorting on mixed alpha numeric array of object.

const alphaNumSort = require('@rhtvma/alpha-num-sort');

const data = { "mixed": "1z", "model": "Gi1/0/10" }, { "mixed": "5x", "model": "Gi2/0/10" }, { "mixed": "6y", "model": "Gi6/0/10" }, { "mixed": "2x", "model": "Gi4/0/10" }, { "mixed": "3y", "model": "Gi3/0/10" }, { "mixed": "11x", "model": "Gi12/0/10" }, { "mixed": "7z", "model": "Gi5/0/10" }, { "mixed": "8x", "model": "Gi11/0/10" }, { "mixed": "13z", "model": "Gi8/0/10" }, { "mixed": "4z", "model": "Gi13/0/10" }, { "mixed": "9y", "model": "Gi7/0/10" }, { "mixed": "10z", "model": "Gi9/0/10" }, { "mixed": "12y", "model": "Gi10/0/10" }, ;

console.log(alphaNumSort.sort(data, 1, 'model'));

/**

  • First Parameter : obj {Array of objects}
  • Second Parameter : order {ASC : 1, DESC: -1}
  • Third Parameter : field {perticular key on which need to perform sorting} */
1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago