es.array.join.js 746 B

12345678910111213141516171819
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var uncurryThis = require('../internals/function-uncurry-this');
  4. var IndexedObject = require('../internals/indexed-object');
  5. var toIndexedObject = require('../internals/to-indexed-object');
  6. var arrayMethodIsStrict = require('../internals/array-method-is-strict');
  7. var un$Join = uncurryThis([].join);
  8. var ES3_STRINGS = IndexedObject != Object;
  9. var STRICT_METHOD = arrayMethodIsStrict('join', ',');
  10. // `Array.prototype.join` method
  11. // https://tc39.es/ecma262/#sec-array.prototype.join
  12. $({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {
  13. join: function join(separator) {
  14. return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator);
  15. }
  16. });