Skip to content

Commit

Permalink
Fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
ponury-kostek committed Dec 1, 2015
1 parent 19dbef2 commit 2e1c7c6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "utls",
"version": "0.2.1",
"version": "0.2.2",
"description": "Utilities",
"main": "index.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions src/utls.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class utls {
type = value.name.length ? value.name : type;
break;
case 'Object':
type = value.constructor.name.length ? value.constructor.name : type;
break;
default:
break;
Expand Down
14 changes: 12 additions & 2 deletions test/utls.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,12 @@ describe("getType", function () {
it('should return Function for function() {}', function () {
assert.equal(utls.getType(function () {
}), "Function");

});
describe("getType named function", function () {
it('should return NamedFunction for function NamedFunction() {}', function () {
assert.equal(utls.getType(function NamedFunction () {
}), "NamedFunction");
});
});
it('should not return Function for true', function () {
assert.notEqual(utls.getType(true), "Function");
Expand Down Expand Up @@ -192,7 +197,12 @@ describe("getType", function () {
it('should return Object for {}, {prop : "value"}', function () {
assert.equal(utls.getType({}), "Object");
assert.equal(utls.getType({prop : 'value'}), "Object");

});
describe("getType named object", function () {
it('should return NamedObject for ', function () {
class NamedObject {}
assert.equal(utls.getType(new NamedObject()), "NamedObject");
});
});
it('should not return Object for true', function () {
assert.notEqual(utls.getType(true), "Object");
Expand Down

0 comments on commit 2e1c7c6

Please sign in to comment.