_collection-to-json.js 317 B

123456789
  1. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  2. var classof = require('./_classof');
  3. var from = require('./_array-from-iterable');
  4. module.exports = function (NAME) {
  5. return function toJSON() {
  6. if (classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic");
  7. return from(this);
  8. };
  9. };