File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,8 @@ Output will be -
5454
5555### Versions
5656
57+ + ` v1.0.1 `
58+ + Bug Fixed : data null checks & default true fix
5759+ ` v1.0.0 `
5860 + Initial release - containing basic `sort` function only.
5961
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
2222 */
2323const typeOf = function ( data ) {
2424 const objectConstructor = { } . constructor ;
25- if ( data . constructor === objectConstructor ) {
25+ if ( data && data !== null && data . constructor === objectConstructor ) {
2626 return "OBJECT" ;
2727 } else {
2828 return "" ;
@@ -44,7 +44,7 @@ function jsonSort(data, sort) {
4444 newData = { } ;
4545
4646 if ( ! sort )
47- sort = false ;
47+ sort = true ;
4848
4949 keys = Object . keys ( data ) . sort ( ) ;
5050
Original file line number Diff line number Diff line change 11{
22 "name" : " json-keys-sort" ,
3- "version" : " 1.0.0 " ,
3+ "version" : " 1.0.1 " ,
44 "description" : " Sorting a json object based on keys either ascending or descending & even recursively" ,
55 "main" : " index.js" ,
66 "repository" : {
You can’t perform that action at this time.
0 commit comments