DATE-ARRAY-SORTING
Date array sorting is a Node library for dealing with all type of date, timestamp, array sorting and array filtering based on the Key.
Installation
Use the package manager npm to install htmlpdfconversion.
npm install date-array-sorting
Sample Request
# For getting the Sorted value of date with minimum and maximum value of date
sample Json: { "date" : ["03-01-2019","03-10-2019","03-04-2019","03-02-2019","03-09-2019"] }
#For getting the Sorted value of timestamp with minimum and maximum value of timestamp
sample Json : { "timestamp" : ["2019-03-02T17:50:36.024Z","2019-03-03T19:50:36.024Z","2019-03-04T17:50:36.024Z","2019-03-01T17:50:36.024Z"] }
# Function for getting the filtered value from an array
sample Json : { "arr": [ { "code_id": "1", "code_name": "code 1" }, { "code_id": "2", "code_name": "code889" } ], "key": "code_id", "value": "2" }
Usage
var datearraysort = require('date-array-sorting');1) For Date Sortingrequest = { "date" : ["03-01-2019","03-10-2019","03-04-2019","03-02-2019","03-09-2019"] } # datearraysort.sortDate(request);2) For Time Sortingrequest = { "timestamp" : ["2019-03-02T17:50:36.024Z","2019-03-03T19:50:36.024Z","2019-03-04T17:50:36.024Z","2019-03-01T17:50:36.024Z"] } datearraysort.sortTimeStamp(request);3)For array Filterrequest = { "arr": [ { "code_id": "1", "code_name": "code 1" }, { "code_id": "2", "code_name": "code889" } ], "key": "code_id", "value": "2"} datearraysort.filterArray(request);4) For ascending and descending order datearraysort.upperSort(request) datearraysort.lowerSort(request)5)For Sorting based on the key Namerequest = { "arr": [ { "ID": 135, "Name": "Fargo Chan", "Address": "34, Baker Street" }, { "ID": 432, "Name": "Aaron Luke", "Address": "BLDG 1, J Street" }, { "ID": 252, "Name": "Dilip Singh", "Address": "Hotel J, SE" } ], "key": "ID" // Key value Must Be changed According to the JSON Value Sorting must be done on the basis of Key Value} datearraysort.jsonArraySort(request);
NOTE
Verify JSON For Getting the Sorted Array or filtered Array. Please verify the Valid JSON.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
[MIT]