UNPKG

503 BJavaScriptView Raw
1var fails = require('../internals/fails');
2var classof = require('../internals/classof-raw');
3
4var split = ''.split;
5
6// fallback for non-array-like ES3 and non-enumerable old V8 strings
7module.exports = fails(function () {
8 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
9 // eslint-disable-next-line no-prototype-builtins
10 return !Object('z').propertyIsEnumerable(0);
11}) ? function (it) {
12 return classof(it) == 'String' ? split.call(it, '') : Object(it);
13} : Object;