Skip to content

Commit

Permalink
Support objects that are created with Object.create(null)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsen1 committed Dec 21, 2014
1 parent 78fc7ce commit 3d6f5c7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/json-formatter.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* jsonformatter
*
* Version: 0.2.6 - 2014-12-16T21:33:23.610Z
* Version: 0.2.7 - 2014-12-21T19:57:21.891Z
* License: MIT
*/

Expand Down
5 changes: 4 additions & 1 deletion dist/json-formatter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* jsonformatter
*
* Version: 0.2.6 - 2014-12-16T21:33:46.343Z
* Version: 0.2.7 - 2014-12-21T19:57:21.887Z
* License: MIT
*/

Expand All @@ -22,6 +22,9 @@ angular.module('jsonFormatter', ['RecursionHelper'])
if (object === null) {
return 'Object';
}
if (typeof object === 'object' && !object.constructor) {
return 'Object';
}
var funcNameRegex = /function (.{1,})\(/;
var results = (funcNameRegex).exec((object).constructor.toString());
if (results && results.length > 1) {
Expand Down
2 changes: 1 addition & 1 deletion dist/json-formatter.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/json-formatter.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/json-formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ angular.module('jsonFormatter', ['RecursionHelper'])
if (object === null) {
return 'Object';
}
if (typeof object === 'object' && !object.constructor) {
return 'Object';
}
var funcNameRegex = /function (.{1,})\(/;
var results = (funcNameRegex).exec((object).constructor.toString());
if (results && results.length > 1) {
Expand Down
3 changes: 1 addition & 2 deletions test/json-formatter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ describe('json-formatter', function () {
testEmptyObject('emptyObject');
});

// TODO
xdescribe('empty object without prototype: Object.create(null)', function(){
describe('empty object without prototype: Object.create(null)', function(){
testEmptyObject('emptyObjectWithoutPrototype');
});

Expand Down

0 comments on commit 3d6f5c7

Please sign in to comment.