Skip to content

Commit

Permalink
Updates "isString" to also accept String instances
Browse files Browse the repository at this point in the history
  • Loading branch information
mairatma committed Aug 8, 2016
1 parent f1e8847 commit e26b84f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/metal/src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ class core {
/**
* Returns true if value is a string.
* @param {*} val
* @return {Boolean}
* @return {boolean}
*/
static isString(val) {
return typeof val === 'string';
return typeof val === 'string' || val instanceof String;
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/metal/test/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ describe('core', function() {
assert.ok(!core.isString(undefined));

assert.ok(core.isString(''));
assert.ok(core.isString(new String(''))); // jshint ignore:line
});

it('should check if var is boolean', function() {
Expand Down

0 comments on commit e26b84f

Please sign in to comment.