aboutsummaryrefslogtreecommitdiff
path: root/node_modules/core-js/modules/$.collection-to-json.js
blob: 41f2e6ec742548258d55f4448bdcc7bbc4ec85c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var forOf   = require('./$.for-of')
  , classof = require('./$.classof');
module.exports = function(NAME){
  return function toJSON(){
    if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic");
    var arr = [];
    forOf(this, false, arr.push, arr);
    return arr;
  };
};