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 -
54
54
55
55
### Versions
56
56
57
+ + ` v1.0.1 `
58
+ + Bug Fixed : data null checks & default true fix
57
59
+ ` v1.0.0 `
58
60
+ Initial release - containing basic `sort` function only.
59
61
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
22
22
*/
23
23
const typeOf = function ( data ) {
24
24
const objectConstructor = { } . constructor ;
25
- if ( data . constructor === objectConstructor ) {
25
+ if ( data && data !== null && data . constructor === objectConstructor ) {
26
26
return "OBJECT" ;
27
27
} else {
28
28
return "" ;
@@ -44,7 +44,7 @@ function jsonSort(data, sort) {
44
44
newData = { } ;
45
45
46
46
if ( ! sort )
47
- sort = false ;
47
+ sort = true ;
48
48
49
49
keys = Object . keys ( data ) . sort ( ) ;
50
50
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " json-keys-sort" ,
3
- "version" : " 1.0.0 " ,
3
+ "version" : " 1.0.1 " ,
4
4
"description" : " Sorting a json object based on keys either ascending or descending & even recursively" ,
5
5
"main" : " index.js" ,
6
6
"repository" : {
You can’t perform that action at this time.
0 commit comments