Skip to content

Commit

Permalink
Implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 29, 2015
1 parent 575ad81 commit 0471d59
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

var strValue = String.prototype.valueOf;

This comment has been minimized.

Copy link
@Mouvedia

Mouvedia Jun 28, 2015

Why are you using valueOf instead of toString?

This comment has been minimized.

Copy link
@ljharb

ljharb Jun 28, 2015

Author Member

Both would work identically - but since caja is using String.prototype.valueOf for this use case, I figured I should be consistent.


module.exports = function isString(value) {
try {
strValue.call(value);
return true;
} catch (e) {
return false;
}
};

0 comments on commit 0471d59

Please sign in to comment.