Skip to content

Commit

Permalink
fix: take all changes in safeToString
Browse files Browse the repository at this point in the history
In early ES6 implementations String(symbol) crashed while symbol.toString() returned string as expected
  • Loading branch information
medikoo committed May 15, 2017
1 parent c9ce4d0 commit 3c5cd12
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions safe-to-string.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
'use strict';

var isCallable = require('./object/is-callable');

module.exports = function (value) {
try {
if (value && isCallable(value.toString)) return value.toString();
return String(value);
} catch (e) {
return "<non-stringifiable value>";
Expand Down

0 comments on commit 3c5cd12

Please sign in to comment.