{"_id":"symbol-es6","_rev":"6-2495ed6ef833fc4ee91810113dd2e6e2","name":"symbol-es6","description":"ES6 Symbol polyfill in pure ES5","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"symbol-es6","version":"0.1.0","description":"Provides Symbol implementation of ES6 in pure ES5 for older browsers and JS engines","main":"symbol-es6.js","directories":{"test":"test"},"scripts":{"test":"node ./test/test.js"},"repository":{"type":"git","url":"git+https://github.com/ariyankhan/symbol-es6.git"},"keywords":["es","es6","es5","symbol","es6-symbol","polyfill","ponyfill","js","implementation","harmony-symbol","js-symbol","es-symbol"],"author":{"name":"Ariyan Khan"},"license":"MIT","bugs":{"url":"https://github.com/ariyankhan/symbol-es6/issues"},"homepage":"https://github.com/ariyankhan/symbol-es6#readme","gitHead":"8c68c9e2a3c4f98ca652559db7b2a726f5b4cd2d","_id":"symbol-es6@0.1.0","_shasum":"7bdda2c072e4177ad561d845cb085c3b87723840","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.3","_npmUser":{"name":"ariyankhan","email":"ariyankhancdr@gmail.com"},"dist":{"shasum":"7bdda2c072e4177ad561d845cb085c3b87723840","tarball":"https://registry.npmjs.org/symbol-es6/-/symbol-es6-0.1.0.tgz","integrity":"sha512-Nxk7zdXICvF+z7gpLQuD8vlvZUSqzyVeEMGtgwlQxePCZJaUKwl9UuOkWZmwSzCPkye2A5udjbKKa1jC1LNy/g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHnLh57KkHshHcoP7RnY6kuOIesMW6btDLwEIt52aTRIAiEA5jYUfmVY8QUs3b7zy9ISTk71I14rgxa2jng4D/unfxg="}]},"maintainers":[{"name":"ariyankhan","email":"ariyankhancdr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/symbol-es6-0.1.0.tgz_1497386006806_0.7734700085129589"}},"0.1.1":{"name":"symbol-es6","version":"0.1.1","description":"Provides Symbol implementation of ES6 in pure ES5 for older browsers and JS engines","main":"symbol-es6.js","directories":{"test":"test"},"scripts":{"test":"node ./test/test.js"},"repository":{"type":"git","url":"git+https://github.com/ariyankhan/symbol-es6.git"},"keywords":["es","es6","es5","symbol","es6-symbol","polyfill","ponyfill","js","implementation","harmony-symbol","js-symbol","es-symbol"],"author":{"name":"Ariyan Khan"},"license":"MIT","bugs":{"url":"https://github.com/ariyankhan/symbol-es6/issues"},"homepage":"https://github.com/ariyankhan/symbol-es6#readme","gitHead":"0f4f4ccabb017511e6cc9b83d01e4b0e9d252baf","_id":"symbol-es6@0.1.1","_shasum":"45e1904a4e9375dc0d15335f73b33512416b0b41","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.3","_npmUser":{"name":"ariyankhan","email":"ariyankhancdr@gmail.com"},"dist":{"shasum":"45e1904a4e9375dc0d15335f73b33512416b0b41","tarball":"https://registry.npmjs.org/symbol-es6/-/symbol-es6-0.1.1.tgz","integrity":"sha512-EOK71yHx9BQWb2iRgAY8O2p5PtaOPpXrqwAEKWrUF+x9+TY2Jgm980sFvsfAe4LLAShUci1efW7YsVu7bUAArQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAZAG2vTuPJ0scdvvFTRnrHAUiYXwdIEcP12wFJLlWg5AiB2XFaKnHSeYUfRKsDtbrapMI0H4n2UcRHChZLxtTZDbA=="}]},"maintainers":[{"name":"ariyankhan","email":"ariyankhancdr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/symbol-es6-0.1.1.tgz_1497523346743_0.5515135487075895"}},"0.1.2":{"name":"symbol-es6","version":"0.1.2","description":"ES6 Symbol polyfill in pure ES5","main":"symbol-es6.js","scripts":{"build":"uglifyjs --source-map --compress --output dist/symbol-es6.min.js -- symbol-es6.js","test":"node ./test/test.js"},"repository":{"type":"git","url":"git+https://github.com/rousan/symbol-es6.git"},"keywords":["es","es6","es5","symbol","es6-symbol","polyfill","ponyfill","js","implementation","harmony-symbol","js-symbol","es-symbol"],"author":{"name":"Rousan Ali","email":"rousanali786@gmail.com","url":"https://rousan.io"},"license":"MIT","bugs":{"url":"https://github.com/rousan/symbol-es6/issues"},"homepage":"https://github.com/rousan/symbol-es6#readme","devDependencies":{"uglify-js":"^3.3.9"},"gitHead":"0d33ba8a3830f5f97421f2963891421edf5f6332","_id":"symbol-es6@0.1.2","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"rousan","email":"rousanali786@gmail.com"},"dist":{"integrity":"sha512-89PIBchwCz+SaDjrWW4Scd4aCYmJKOEDwsxwBoCsrUeQGFpgyUsW/tsxZKYtZ3vBthRQGkcbl4GEgzkwxW3t6g==","shasum":"128448dc5f604a5f9c15a82d4f417d4480817531","tarball":"https://registry.npmjs.org/symbol-es6/-/symbol-es6-0.1.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCqzGVwVyKfJ+oB/VeKhotNqvHvVkNN6gMBnlBRKroxGwIhAK7k6ivQXbjkuANW/2E72FkCBSFBZgRGGW/e2pz8ZEHh"}]},"maintainers":[{"email":"rousanali786@gmail.com","name":"rousan"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/symbol-es6-0.1.2.tgz_1517161283205_0.8751705894246697"}}},"readme":"[![NPM version](https://img.shields.io/npm/v/symbol-es6.svg)](https://www.npmjs.com/package/symbol-es6)\n[![NPM total downloads](https://img.shields.io/npm/dt/symbol-es6.svg)](https://www.npmjs.com/package/symbol-es6)\n[![Contributors](https://img.shields.io/github/contributors/rousan/symbol-es6.svg)](https://github.com/rousan/symbol-es6/graphs/contributors)\n[![License](https://img.shields.io/github/license/rousan/symbol-es6.svg)](https://github.com/rousan/symbol-es6/blob/master/LICENSE)\n\n# Symbol-ES6\n\nProvides support for `ES6` Symbol API in `ES5` for older JS environments i.e. older browsers or NodeJS.\n\n> ES6 Symbol polyfill in pure ES5.\n\n## Install\n\n### NPM\n\nInstall it from `npm` and `require` it before any other modules:\n\n```bash\n$ npm install --save symbol-es6\n```\n\n```javascript\nrequire(\"symbol-es6\");\n```\n\n### CDN\n\nIf you prefer CDN, then just insert it into your HTML page on the top of other scripts:\n\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/symbol-es6/dist/symbol-es6.min.js\"></script>\n```\n\n## Examples\n\n```javascript\n\"use strict\";\n\nvar ES6 = require(\"symbol-es6\");\n\nconsole.log(Symbol(\"bar\") === Symbol(\"bar\")); //false\n\nvar sym = Symbol.for(\"bar\");\nvar sym2 = Symbol(\"bar\");\n\nconsole.log(Symbol.for(\"bar\") === sym); //true\nconsole.log(sym === sym2); //false\nconsole.log(Symbol.keyFor(sym)); //bar\nconsole.log(Symbol.keyFor(sym2)); //undefined\n\nconsole.log(Array.from(\"Hello\")); //[ 'H', 'e', 'l', 'l', 'o' ]\n\nvar it = [1, 2].entries();\n\nconsole.log(it.next()); //{ done: false, value: [ 0, 1 ] }\nconsole.log(it.next()); //{ done: false, value: [ 1, 2 ] }\nconsole.log(it.next()); //{ done: true, value: undefined }\n\nit = [1, 2].keys();\n\nconsole.log(it.next()); //{ done: false, value: 0 }\nconsole.log(it.next()); //{ done: false, value: 1 }\nconsole.log(it.next()); //{ done: true, value: undefined }\n\nfunction Bar() {\n}\nconsole.log(Object.prototype.toString.call(new Bar())); //[object Object]\n\nBar.prototype[Symbol.toStringTag] = \"Bar\";\n\nconsole.log(Object.prototype.toString.call(new Bar())); //[object Bar]\n\nit = \"Bar\"[Symbol.iterator]();\n\nconsole.log(it.next()); //{ done: false, value: 'B' }\nconsole.log(it.next()); //{ done: false, value: 'a' }\nconsole.log(it.next()); //{ done: false, value: 'r' }\n\n\nconsole.log(ES6.isSymbol({})); //fasle\nconsole.log(ES6.isSymbol(sym)); ///true\n\nfunction Baz() {\n\n}\nconsole.log(ES6.instanceOf(89, Baz)); //false\nObject.defineProperty(Baz, Symbol.hasInstance, {\n   value: function (value) {\n       return typeof value === \"number\";\n   }\n});\nconsole.log(ES6.instanceOf(89, Baz)); //true\n\nES6.forOf([1, 2], function (v) {\n    console.log(v);\n});\n//1\n//2\n\nconsole.log(ES6.spreadOperator([]).spread(\"Bar\").array()); //[ 'B', 'a', 'r' ]\n\nfunction TestSpread() {\n    return Array.prototype.reduce.call(arguments, function (acc, currvalue) {\n        return acc + currvalue;\n    }, 0);\n}\n\nconsole.log(ES6.spreadOperator(TestSpread).spread([1, 2, 3, 4, 5]).call()); //15\n\nfunction Student(name, roll) {\n    this.name = name;\n    this.roll = roll;\n}\n\nconsole.log(ES6.spreadOperator(Student).spread([\"Ariyan\", 10]).new().name); //Ariyan\n```\n\n## Polyfills\n\n* `Symbol`\n    * `for()`\n    * `keyFor`\n    * `@@hasInstance`\n    * `@@isConcatSpreadable`\n    * `@@iterator`\n    * `@@toStringTag`\n    * `Symbol.prototype.toString()`\n    * `Symbol.prototype.valueOf()`\n    \n* `Function`\n    * `Function.prototype[@@hasInstance]()`\n    \n* `Array`\n    * `Array.prototype.concat()` (ES6 version, addition of `@@isConcatSpreadable` support)\n    * `Array.prototype[@@iterator]()`\n    * `Array.from()`\n    * `Array.prototype.entries()`\n    * `Array.prototype.keys()`\n\n* `Object`\n    * `Object.prototype.toString()` (ES6 version, addition of `@@toStringTag` support)\n\n* `String`\n    * `String.prototype[@@iterator]()`\n\n\n## Limitation\n\nSome `ES6` features can't be implemented in `ES5` natively like `spread operator`, `for..of` loop,\n`ES6` version of `instanceOf` operator etc. So this module exports a object named `ES6` globally,\nthat provides some approximate equivalent implementation of those features.\n\n## `ES6` Object\n\nThis object provides,\n\n* `isSymbol()` (It can be used as equivalent API of: `typeof symbol === 'symbol'`)\n* `instanceOf()` (Provides ES6 version of `instanceOf`)\n* `forOf()` (This method behaves exactly same as ES6 `for...of` loop)\n* `spreadOperator` (Gives same functionality of the `spread operator` of ES6)\n\n## Contributing\n\nYour PRs and stars are always welcome.\n\nPlease, try to follow:\n\n* Clone the repository.\n* Checkout `develop` branch.\n* Install dependencies.\n* Add your new features or fixes.\n* Build the project.\n\n```sh\n$ git clone https://github.com/rousan/symbol-es6.git\n$ cd symbol-es6\n$ git checkout develop\n$ npm i\n$ npm run build\n```","maintainers":[{"email":"rousanali786@gmail.com","name":"rousan"}],"time":{"modified":"2022-06-27T03:05:32.388Z","created":"2017-06-13T20:33:27.705Z","0.1.0":"2017-06-13T20:33:27.705Z","0.1.1":"2017-06-15T10:42:26.876Z","0.1.2":"2018-01-28T17:41:24.159Z"},"homepage":"https://github.com/rousan/symbol-es6#readme","keywords":["es","es6","es5","symbol","es6-symbol","polyfill","ponyfill","js","implementation","harmony-symbol","js-symbol","es-symbol"],"repository":{"type":"git","url":"git+https://github.com/rousan/symbol-es6.git"},"author":{"name":"Rousan Ali","email":"rousanali786@gmail.com","url":"https://rousan.io"},"bugs":{"url":"https://github.com/rousan/symbol-es6/issues"},"license":"MIT","readmeFilename":"README.md"}