{"_id":"@iconify/json-tools","_rev":"1725889","name":"@iconify/json-tools","description":"Functions for manipulating Iconify JSON SVG collections.","dist-tags":{"latest":"1.0.10"},"maintainers":[{"name":"cyberalien","email":"cyberalien@gmail.com"}],"time":{"modified":"2024-10-21T01:57:44.000Z","created":"2018-10-31T18:38:50.503Z","1.0.10":"2020-12-16T12:32:17.094Z","1.0.9":"2020-06-23T14:58:36.641Z","1.0.8":"2020-04-04T21:32:33.545Z","1.0.7":"2020-02-27T10:15:26.425Z","1.0.6":"2019-03-02T11:39:19.755Z","1.0.5":"2019-02-10T11:53:15.697Z","1.0.4":"2019-01-26T14:02:22.926Z","1.0.3":"2019-01-12T16:21:56.677Z","1.0.2":"2019-01-11T14:56:07.747Z","1.0.1":"2018-11-02T08:05:02.255Z","1.0.0":"2018-10-31T21:00:03.955Z","1.0.0-beta2":"2018-10-31T20:39:50.638Z","1.0.0-beta1":"2018-10-31T18:38:50.503Z"},"users":{},"author":{"name":"Vjacheslav Trushkin"},"repository":{"type":"git","url":"git+https://github.com/iconify/json-tools.js.git"},"versions":{"1.0.10":{"name":"@iconify/json-tools","description":"Functions for manipulating Iconify JSON SVG collections.","author":{"name":"Vjacheslav Trushkin"},"version":"1.0.10","license":"MIT","bugs":{"url":"https://github.com/iconify/json-tools.js/issues"},"homepage":"https://github.com/iconify/json-tools.js","repository":{"type":"git","url":"git+https://github.com/iconify/json-tools.js.git"},"main":"src/modules.js","scripts":{"test":"mocha tests/*_test.js"},"devDependencies":{"@iconify/json":"^1.1.252","chai":"^4.2.0","mocha":"^8.2.1"},"gitHead":"0a4a71b34c4cc32b5c9d5f1257ae0b26770aa13a","_id":"@iconify/json-tools@1.0.10","_nodeVersion":"15.2.0","_npmVersion":"7.0.13","dist":{"shasum":"d9a7050dbbe8bb29d684d4b3f9446ed2d0bea3cc","size":21096,"noattachment":false,"key":"/@iconify/json-tools/-/@iconify/json-tools-1.0.10.tgz","tarball":"http://registry.cnpm.dingdandao.com/@iconify/json-tools/download/@iconify/json-tools-1.0.10.tgz"},"_npmUser":{"name":"cyberalien","email":"cyberalien@gmail.com"},"directories":{},"maintainers":[{"name":"cyberalien","email":"cyberalien@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-tools_1.0.10_1608121936970_0.2392385736426612"},"_hasShrinkwrap":false,"publish_time":1608121937094,"_cnpm_publish_time":1608121937094,"deprecated":"no longer maintained, use @iconify/utils"},"1.0.9":{"name":"@iconify/json-tools","description":"Functions for manipulating Iconify JSON SVG collections.","author":{"name":"Vjacheslav Trushkin"},"version":"1.0.9","license":"MIT","bugs":{"url":"https://github.com/iconify/json-tools.js/issues"},"homepage":"https://github.com/iconify/json-tools.js","repository":{"type":"git","url":"git+https://github.com/iconify/json-tools.js.git"},"main":"src/modules.js","scripts":{"test":"mocha tests/*_test.js"},"devDependencies":{"@iconify/json":"^1.1.178","chai":"^4.2.0","mocha":"^5.2.0"},"gitHead":"693037c97edcd8883116006bac38c3615210c3bb","_id":"@iconify/json-tools@1.0.9","_nodeVersion":"13.12.0","_npmVersion":"6.14.5","dist":{"shasum":"62fdbeef0a30e28a23a1bf8063d4edc6d36c3f94","size":21161,"noattachment":false,"key":"/@iconify/json-tools/-/@iconify/json-tools-1.0.9.tgz","tarball":"http://registry.cnpm.dingdandao.com/@iconify/json-tools/download/@iconify/json-tools-1.0.9.tgz"},"maintainers":[{"name":"cyberalien","email":"cyberalien@gmail.com"}],"_npmUser":{"name":"cyberalien","email":"cyberalien@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-tools_1.0.9_1592924316501_0.22576113491831484"},"_hasShrinkwrap":false,"publish_time":1592924316641,"_cnpm_publish_time":1592924316641,"deprecated":"no longer maintained, use @iconify/utils"},"1.0.8":{"name":"@iconify/json-tools","description":"Functions for manipulating Iconify JSON SVG collections.","author":{"name":"Vjacheslav Trushkin"},"version":"1.0.8","license":"MIT","bugs":{"url":"https://github.com/iconify/json-tools.js/issues"},"homepage":"https://github.com/iconify/json-tools.js","repository":{"type":"git","url":"git+ssh://git@github.com/iconify/json-tools.js.git"},"main":"src/modules.js","scripts":{"test":"mocha tests/*_test.js"},"devDependencies":{"@iconify/json":"^1.1.105","chai":"^4.2.0","mocha":"^5.2.0"},"gitHead":"f5bf82f4efd28299ef588ee39a760b4b628ab757","_id":"@iconify/json-tools@1.0.8","_nodeVersion":"13.12.0","_npmVersion":"6.14.4","dist":{"shasum":"629aad397385fab0d11803bc07c11bd19e065dd9","size":21173,"noattachment":false,"key":"/@iconify/json-tools/-/@iconify/json-tools-1.0.8.tgz","tarball":"http://registry.cnpm.dingdandao.com/@iconify/json-tools/download/@iconify/json-tools-1.0.8.tgz"},"maintainers":[{"name":"cyberalien","email":"cyberalien@gmail.com"}],"_npmUser":{"name":"cyberalien","email":"cyberalien@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-tools_1.0.8_1586035953354_0.5240993499554514"},"_hasShrinkwrap":false,"publish_time":1586035953545,"_cnpm_publish_time":1586035953545,"deprecated":"no longer maintained, use @iconify/utils"},"1.0.7":{"name":"@iconify/json-tools","description":"Functions for manipulating Iconify JSON SVG collections.","author":{"name":"Vjacheslav Trushkin"},"version":"1.0.7","license":"MIT","bugs":{"url":"https://github.com/iconify/json-tools.js/issues"},"homepage":"https://github.com/iconify/json-tools.js","repository":{"type":"git","url":"git+ssh://git@github.com/iconify/json-tools.js.git"},"main":"src/modules.js","scripts":{"test":"mocha tests/*_test.js"},"devDependencies":{"@iconify/json":"^1.1.105","chai":"^4.2.0","mocha":"^5.2.0"},"gitHead":"d104e37f48af5b8798b2a2c040e6da80e6415715","_id":"@iconify/json-tools@1.0.7","_nodeVersion":"13.8.0","_npmVersion":"6.13.7","dist":{"shasum":"b3bdf6db8590a1d67c756963eccf3f73109c40c2","size":21636,"noattachment":false,"key":"/@iconify/json-tools/-/@iconify/json-tools-1.0.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/@iconify/json-tools/download/@iconify/json-tools-1.0.7.tgz"},"maintainers":[{"name":"cyberalien","email":"cyberalien@gmail.com"}],"_npmUser":{"name":"cyberalien","email":"cyberalien@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-tools_1.0.7_1582798526271_0.498473758369417"},"_hasShrinkwrap":false,"publish_time":1582798526425,"_cnpm_publish_time":1582798526425,"deprecated":"no longer maintained, use @iconify/utils"},"1.0.6":{"name":"@iconify/json-tools","description":"Functions for manipulating Iconify JSON SVG collections.","author":{"name":"Vjacheslav Trushkin"},"version":"1.0.6","license":"MIT","bugs":{"url":"https://github.com/iconify-design/json-tools.js/issues"},"homepage":"https://github.com/iconify-design/json-tools.js","repository":{"type":"git","url":"git+ssh://git@github.com/iconify-design/json-tools.js.git"},"main":"src/modules.js","scripts":{"test":"mocha tests/*_test.js"},"devDependencies":{"@iconify/json":"^1.0.72","chai":"^4.2.0","mocha":"^5.2.0"},"gitHead":"747aa9061431250a674b0f6017d685f0ea4a19a7","_id":"@iconify/json-tools@1.0.6","_nodeVersion":"10.9.0","_npmVersion":"6.8.0","dist":{"shasum":"c06fdbcd8bf010d6e55107376cd0686d02dcbd46","size":20990,"noattachment":false,"key":"/@iconify/json-tools/-/@iconify/json-tools-1.0.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/@iconify/json-tools/download/@iconify/json-tools-1.0.6.tgz"},"maintainers":[{"name":"cyberalien","email":"cyberalien@gmail.com"}],"_npmUser":{"name":"cyberalien","email":"cyberalien@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-tools_1.0.6_1551526759583_0.9664914769609483"},"_hasShrinkwrap":false,"publish_time":1551526759755,"_cnpm_publish_time":1551526759755,"deprecated":"no longer maintained, use @iconify/utils"},"1.0.5":{"name":"@iconify/json-tools","description":"Functions for manipulating Iconify JSON SVG collections.","author":{"name":"Vjacheslav Trushkin"},"version":"1.0.5","license":"MIT","bugs":{"url":"https://github.com/iconify-design/json-tools.js/issues"},"homepage":"https://github.com/iconify-design/json-tools.js","repository":{"type":"git","url":"git+ssh://git@github.com/iconify-design/json-tools.js.git"},"main":"src/modules.js","scripts":{"test":"mocha tests/*_test.js"},"devDependencies":{"@iconify/json":"^1.0.62","chai":"^4.2.0","mocha":"^5.2.0"},"gitHead":"ea0309aabb1b4c9ee17435345a3fdec8fe72b9a6","_id":"@iconify/json-tools@1.0.5","_nodeVersion":"10.9.0","_npmVersion":"6.7.0","dist":{"shasum":"68a8baed8def2ea3c66c313da46ab931a6db796e","size":20591,"noattachment":false,"key":"/@iconify/json-tools/-/@iconify/json-tools-1.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/@iconify/json-tools/download/@iconify/json-tools-1.0.5.tgz"},"maintainers":[{"name":"cyberalien","email":"cyberalien@gmail.com"}],"_npmUser":{"name":"cyberalien","email":"cyberalien@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-tools_1.0.5_1549799595525_0.9819056809840421"},"_hasShrinkwrap":false,"publish_time":1549799595697,"_cnpm_publish_time":1549799595697,"deprecated":"no longer maintained, use @iconify/utils"},"1.0.4":{"name":"@iconify/json-tools","description":"Functions for manipulating Iconify JSON SVG collections.","author":{"name":"Vjacheslav Trushkin"},"version":"1.0.4","license":"MIT","bugs":{"url":"https://github.com/iconify-design/json-tools.js/issues"},"homepage":"https://github.com/iconify-design/json-tools.js","repository":{"type":"git","url":"git+ssh://git@github.com/iconify-design/json-tools.js.git"},"main":"src/modules.js","scripts":{"test":"mocha tests/*_test.js"},"devDependencies":{"@iconify/json":"^1.0.45","chai":"^4.2.0","mocha":"^5.2.0"},"gitHead":"5f567aac989cf9ffc8c0a322a56569314cf50517","_id":"@iconify/json-tools@1.0.4","_nodeVersion":"10.9.0","_npmVersion":"6.7.0","dist":{"shasum":"a97187b628d2d208c406415438d7cc1cc08d44fa","size":20537,"noattachment":false,"key":"/@iconify/json-tools/-/@iconify/json-tools-1.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/@iconify/json-tools/download/@iconify/json-tools-1.0.4.tgz"},"maintainers":[{"name":"cyberalien","email":"cyberalien@gmail.com"}],"_npmUser":{"name":"cyberalien","email":"cyberalien@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-tools_1.0.4_1548511342792_0.5666109783196815"},"_hasShrinkwrap":false,"publish_time":1548511342926,"_cnpm_publish_time":1548511342926,"deprecated":"no longer maintained, use @iconify/utils"},"1.0.3":{"name":"@iconify/json-tools","description":"Functions for manipulating Iconify JSON SVG collections.","author":{"name":"Vjacheslav Trushkin"},"version":"1.0.3","license":"MIT","bugs":{"url":"https://github.com/iconify-design/json-tools.js/issues"},"homepage":"https://github.com/iconify-design/json-tools.js","repository":{"type":"git","url":"git+ssh://git@github.com/iconify-design/json-tools.js.git"},"main":"src/modules.js","scripts":{"test":"mocha tests/*_test.js"},"devDependencies":{"@iconify/json":"^1.0.45","chai":"^4.2.0","mocha":"^5.2.0"},"gitHead":"742e791b4922cc12ceceeb56f781343f4ba95b00","_id":"@iconify/json-tools@1.0.3","_npmVersion":"6.4.1","_nodeVersion":"10.9.0","_npmUser":{"name":"cyberalien","email":"cyberalien@gmail.com"},"dist":{"shasum":"45cedefae68bf67d964b5d879bb5d73a106a7bb8","size":20437,"noattachment":false,"key":"/@iconify/json-tools/-/@iconify/json-tools-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/@iconify/json-tools/download/@iconify/json-tools-1.0.3.tgz"},"maintainers":[{"name":"cyberalien","email":"cyberalien@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-tools_1.0.3_1547310116494_0.17953352769314046"},"_hasShrinkwrap":false,"publish_time":1547310116677,"_cnpm_publish_time":1547310116677,"deprecated":"no longer maintained, use @iconify/utils"},"1.0.2":{"name":"@iconify/json-tools","description":"Functions for manipulating Iconify JSON SVG collections.","author":{"name":"Vjacheslav Trushkin"},"version":"1.0.2","license":"MIT","bugs":{"url":"https://github.com/iconify-design/json-tools.js/issues"},"homepage":"https://github.com/iconify-design/json-tools.js","repository":{"type":"git","url":"git+ssh://git@github.com/iconify-design/json-tools.js.git"},"main":"src/modules.js","scripts":{"test":"mocha tests/*_test.js"},"devDependencies":{"@iconify/json":"^1.0.43","chai":"^4.2.0","mocha":"^5.2.0"},"gitHead":"32c85ee5b3b3ed72482d43c2aa004361ee4fe7b2","_id":"@iconify/json-tools@1.0.2","_npmVersion":"6.4.1","_nodeVersion":"10.9.0","_npmUser":{"name":"cyberalien","email":"cyberalien@gmail.com"},"dist":{"shasum":"4b1eddc1957cdc02af33f2a7e1b8e35440ca27d0","size":20053,"noattachment":false,"key":"/@iconify/json-tools/-/@iconify/json-tools-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@iconify/json-tools/download/@iconify/json-tools-1.0.2.tgz"},"maintainers":[{"name":"cyberalien","email":"cyberalien@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-tools_1.0.2_1547218567624_0.8444383152104653"},"_hasShrinkwrap":false,"publish_time":1547218567747,"_cnpm_publish_time":1547218567747,"deprecated":"no longer maintained, use @iconify/utils"},"1.0.1":{"name":"@iconify/json-tools","description":"Functions for manipulating Iconify JSON SVG collections.","author":{"name":"Vjacheslav Trushkin"},"version":"1.0.1","license":"MIT","bugs":{"url":"https://github.com/iconify-design/json-tools.js/issues"},"homepage":"https://github.com/iconify-design/json-tools.js","repository":{"type":"git","url":"git+ssh://git@github.com/iconify-design/json-tools.js.git"},"main":"src/modules.js","scripts":{"test":"mocha tests/*_test.js"},"devDependencies":{"chai":"^4.2.0","mocha":"^5.2.0","@iconify/json":"*"},"gitHead":"e10c14244ca41c8eb7bfdfc2ca35527211ce68b8","_id":"@iconify/json-tools@1.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.9.0","_npmUser":{"name":"cyberalien","email":"cyberalien@gmail.com"},"dist":{"shasum":"8de724ad2e060f72e20e63c24e65a586c62233b6","size":19852,"noattachment":false,"key":"/@iconify/json-tools/-/@iconify/json-tools-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@iconify/json-tools/download/@iconify/json-tools-1.0.1.tgz"},"maintainers":[{"name":"cyberalien","email":"cyberalien@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-tools_1.0.1_1541145902076_0.7288759912115867"},"_hasShrinkwrap":false,"publish_time":1541145902255,"_cnpm_publish_time":1541145902255,"deprecated":"no longer maintained, use @iconify/utils"},"1.0.0":{"name":"@iconify/json-tools","description":"Functions for manipulating Iconify JSON SVG collections.","author":{"name":"Vjacheslav Trushkin"},"version":"1.0.0","license":"MIT","bugs":{"url":"https://github.com/iconify-design/json-tools.js/issues"},"homepage":"https://github.com/iconify-design/json-tools.js","repository":{"type":"git","url":"git+ssh://git@github.com/iconify-design/json-tools.js.git"},"main":"src/modules.js","scripts":{"test":"mocha tests/*_test.js"},"devDependencies":{"chai":"^4.2.0","mocha":"^5.2.0","@iconify/json":"*"},"gitHead":"b1713af3cd7184d9d4c668d2598ebbee7036775b","_id":"@iconify/json-tools@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.9.0","_npmUser":{"name":"cyberalien","email":"cyberalien@gmail.com"},"dist":{"shasum":"7a23b1b0573bd22261db9344ff38386d8b6c5c94","size":19173,"noattachment":false,"key":"/@iconify/json-tools/-/@iconify/json-tools-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@iconify/json-tools/download/@iconify/json-tools-1.0.0.tgz"},"maintainers":[{"name":"cyberalien","email":"cyberalien@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-tools_1.0.0_1541019603368_0.636378017537526"},"_hasShrinkwrap":false,"publish_time":1541019603955,"_cnpm_publish_time":1541019603955,"deprecated":"no longer maintained, use @iconify/utils"},"1.0.0-beta2":{"name":"@iconify/json-tools","description":"Functions for manipulating Iconify JSON SVG collections.","author":{"name":"Vjacheslav Trushkin"},"version":"1.0.0-beta2","license":"MIT","bugs":{"url":"https://github.com/iconify-design/json-tools.js/issues"},"homepage":"https://github.com/iconify-design/json-tools.js","repository":{"type":"git","url":"git+ssh://git@github.com/iconify-design/json-tools.js.git"},"main":"src/modules.js","scripts":{"test":"mocha tests/*_test.js"},"devDependencies":{"chai":"^4.2.0","mocha":"^5.2.0","@iconify/json":"*"},"gitHead":"e174a6286441d9dfdce3f5fe8d6d24447a67b711","_id":"@iconify/json-tools@1.0.0-beta2","_npmVersion":"6.4.1","_nodeVersion":"10.9.0","_npmUser":{"name":"cyberalien","email":"cyberalien@gmail.com"},"dist":{"shasum":"d5f2998fec644f005626c50fb495c5c9401fce2b","size":19173,"noattachment":false,"key":"/@iconify/json-tools/-/@iconify/json-tools-1.0.0-beta2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@iconify/json-tools/download/@iconify/json-tools-1.0.0-beta2.tgz"},"maintainers":[{"name":"cyberalien","email":"cyberalien@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-tools_1.0.0-beta2_1541018390474_0.04705040334586785"},"_hasShrinkwrap":false,"publish_time":1541018390638,"_cnpm_publish_time":1541018390638,"deprecated":"no longer maintained, use @iconify/utils"},"1.0.0-beta1":{"name":"@iconify/json-tools","description":"Functions for manipulating Iconify JSON SVG collections.","author":{"name":"Vjacheslav Trushkin"},"version":"1.0.0-beta1","license":"MIT","bugs":{"url":"https://github.com/iconify-design/json-tools.js/issues"},"homepage":"https://github.com/iconify-design/json-tools.js","repository":{"type":"git","url":"git+ssh://git@github.com/iconify-design/json-tools.js.git"},"main":"src/modules.js","scripts":{"test":"mocha tests/*_test.js"},"devDependencies":{"chai":"^4.2.0","mocha":"^5.2.0","@iconify/json":"*"},"gitHead":"392ca283d31db0efc65ae13d93fd1f2782e188f6","_id":"@iconify/json-tools@1.0.0-beta1","_npmVersion":"6.4.1","_nodeVersion":"10.9.0","_npmUser":{"name":"cyberalien","email":"cyberalien@gmail.com"},"dist":{"shasum":"71c58256b7ecef59d625802f930b13fcd2beed35","size":19130,"noattachment":false,"key":"/@iconify/json-tools/-/@iconify/json-tools-1.0.0-beta1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@iconify/json-tools/download/@iconify/json-tools-1.0.0-beta1.tgz"},"maintainers":[{"name":"cyberalien","email":"cyberalien@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-tools_1.0.0-beta1_1541011130303_0.04746483954531899"},"_hasShrinkwrap":false,"publish_time":1541011130503,"_cnpm_publish_time":1541011130503,"deprecated":"no longer maintained, use @iconify/utils"}},"readme":"# Iconify JSON tools\n\nThis library is used to manipulate JSON icon collections.\n\nThe library is available for PHP and Node.js, code in both versions is almost identical.\n\n## Installation\n\nTo install the library run this command:\n\n```\nnpm install @iconify/json-tools --save\n```\n\nThere are two classes in this package: `Collection` and `SVG`\n\n## Collection class\n\nCollection class represents an icon set.\n\nTo include it use this code:\n\n```js\nconst Collection = require('@iconify/json-tools').Collection;\n```\n\nWhat can Collection class do?\n\n- Read and write JSON collections.\n- Add, remove, list icons in an icon set.\n- Retrieve icon data.\n- Create icon bundles for Iconify icon sets.\n\n### Initializing class instance\n\nThere are two ways to create an instance: with icon set prefix and without icon set prefix.\n\nYou can skip icon set prefix in the constructor if you are going to load data from a JSON file because JSON files contain icon set prefix.\n\n```js\nlet collection = new Collection();\n```\n\n```js\nlet collectionWithPrefix = new Collection('custom-icons');\n```\n\n### Loading JSON data\n\nThere are several functions to load an icon set from JSON file:\n\n- `loadFromFile()` - loads collection synchronously.\n- `loadFromFileAsync()` - loads collection asynchronously (not available in PHP version).\n- `loadJSON()` - loads JSON data from string or object.\n- `loadIconifyCollection()` - loads Iconify collection from `@iconify/json` repository.\n\n#### loadFromFile()\n\nThis function loads an icon set from a JSON file.\n\nFunction parameters:\n\n- `file` - file to load data from.\n- `defaultPrefix` - optional default prefix in case if JSON file does not have it.\n\nReturns:\n\n- boolean - true on success, false on failure\n\n```js\nlet collection = new Collection();\nif (!collection.loadFromFile('json/custom-icons.json')) {\n\tconsole.error('Failed to load custom-icons.json');\n}\n```\n\n#### loadFromFileAsync()\n\nThis function is similar to `loadFromFile()`, but it returns `Promise` and loads file asynchronously.\n\nThis function is not available in PHP version of this library.\n\n```js\nlet collection = new Collection();\ncollection\n\t.loadFromFileAsync('json/custom-icons.json')\n\t.then((collection) => {\n\t\tconsole.log('Loaded custom-icons.json');\n\t})\n\t.catch((err) => {\n\t\tconsole.error('Failed to load custom-icons.json');\n\t});\n```\n\n#### loadJSON()\n\nThis function loads an icon set from a string or an object.\n\nFunction parameters:\n\n- `data` - JSON string or object.\n- `prefix` - optional prefix if JSON file doesn't include one.\n\nReturns:\n\n- boolean - true on success, false on failure\n\n```js\nlet collection = new Collection();\n// Use this if collection has prefix\nif (!collection.loadJSON(data)) {\n\tconsole.error('Failed to load JSON data');\n}\n```\n\n```js\nlet collection = new Collection();\n// Use this if collection is missing prefix\nif (!collection.loadJSON(data, 'custom-icons')) {\n\tconsole.error('Failed to load JSON data');\n}\n```\n\n#### loadIconifyCollection()\n\nThis function loads Iconify icon set from [@iconify/json](https://github.com/iconify/collections-json) repository.\n\nFunction parameters:\n\n- `name` - the name of the icon set.\n- `dir` - optional root directory of Iconify icon set. Use this option if you want to load Iconify icon set from a custom directory instead of the `@iconify/json` repository.\n\nReturns:\n\n- boolean - true on success, false on failure\n\n```js\nlet collection = new Collection();\nif (!collection.loadIconifyCollection('mdi')) {\n\tconsole.error('Failed to load Material Design Icons');\n}\n```\n\n### Getting icon data\n\nThere are several functions that retrieve icon data from an icon set:\n\n- `getIconData()` - returns full data for one icon. It can be used to generate SVG (see SVG class documentation below).\n- `getIcons()` - returns JSON data for icons, which can be used to import to another JSON collection or can be added to Iconify using `Iconify.addCollection()`.\n- `scriptify()` - returns JavaScript bundle file that can be used to load icons in browser with Iconify.\n\n#### getIconData()\n\nThis function returns JSON data for one icon. It returns full data, including optional fields, so the result can be used to generate SVG.\n\nFunction parameters:\n\n- `name` - icon name.\n\nReturns:\n\n- object - icon data\n\n```js\nlet data = collection.getIconData('arrow-left');\nlet svg = new SVG(data);\ncontainerNode.innerHTML = svg.getSVG({});\n```\n\n#### getIcons()\n\nThis function returns JSON data for selected icons. If used without parameters, it returns JSON data for an entire icon set.\n\nFunction parameters:\n\n- `icons` - icon names array.\n\n```js\nlet data = collection.getIcons(['arrow-left', 'arrow-right', 'home']);\nfs.writeFileSync('bundle.json', JSON.stringify(data), 'utf8');\n```\n\nThis function can also be used to copy collection:\n\n```js\nlet data = collection.getIcons();\nlet newCollection = new Collection();\nnewCollection.loadJSON(data);\n```\n\nUsing `collection.getIcons()` without parameters is the same as accessing `collection.items` object.\n\nWarning: if you use `getIcons()` without parameters, editing result object will affect data stored in collection instance.\n`getIcons()` does not make a copy of the object if you request an entire collection. This does not apply to PHP version of this library.\n\n#### scriptify()\n\nThis is similar to `getIcons()`, but it generates JavaScript file instead of JSON data and parameters are passed as one object.\n\nFunction parameters:\n\n- `options` - options object.\n\nReturns:\n\n- string - JavaScript code you can bundle with your scripts.\n\nOptions object properties:\n\n- `icons` - an array of icons to retrieve. If not set or null, all icons will be retrieved.\n- `optimize` - boolean. If set to true, JSON data will be optimized to make output smaller.\n- `pretty` - boolean. If set to true, JSON data will include white spaces that make output easy to read.\n- `callback` - string. JavaScript callback to wrap JSON data in. The default value is `Iconify.addCollection`.\n\nCode to create a bundle with selected icons from one collection (repeat same code for different collections to make bundle of all icons used on website):\n\n```js\nlet collection = new Collection();\nif (!collection.loadIconifyCollection('mdi')) {\n\tthrow new Error('Cannot load Material Design Icons');\n}\nlet code = collection.scriptify({\n\ticons: ['account', 'account-alert', 'home', 'book-open'],\n\tpretty: false,\n\toptimize: true,\n});\nfs.writeFileSync('bundle-mdi.js', code, 'utf8');\n```\n\n### Adding/removing icons\n\n#### addIcon()\n\nThis function adds a new icon to the icon set.\n\nFunction parameters:\n\n- `name` - icon name.\n- `data` - icon data.\n\nReturns:\n\n- boolean - true on success, false on failure. Failure is possible if an icon is missing 'body' property of if the icon set has no prefix\n\n```js\nlet collection = new Collection('custom-icons');\ncollection.addIcon('arrow', {\n\tbody: '<path d=\"\" />',\n\twidth: 24,\n\theight: 24,\n});\n```\n\n### addAlias()\n\nThis function adds an alias for an existing icon.\n\nFunction parameters:\n\n- `name` - alias name.\n- `parent` - parent icon name.\n- `data` - optional data that should override parent icon's data (such as rotation or flip).\n\nReturns:\n\n- boolean - true on success, false on failure. Failure is possible if the parent icon is missing.\n\n```js\nlet collection = new Collection('custom-icons');\ncollection.addIcon('arrow-left', {\n\tbody: '<path d=\"\" />',\n\twidth: 24,\n\theight: 24,\n});\ncollection.addAlias('arrow-right', 'arrow-left', {\n\thFlip: true,\n});\ncollection.addAlias('arrow-right-alias', 'arrow-right');\n```\n\n### setDefaultIconValue()\n\nSet default value for all icons.\n\nFunction parameters:\n\n- `key` - attribute name.\n- `value` - default value.\n\n```js\ncollection.setDefaultIconValue('height', 24);\n```\n\n### removeIcon()\n\nRemoves an icon or an alias from the icon set.\n\nFunction parameters:\n\n- `name` - icon name.\n- `checkAliases` - if true, the icon set will be checked for aliases that use removed icon as parent icon and those aliases will be removed too. Set to false if you know for sure there are no aliases referencing this icon, otherwise set to true.\n\n```js\nlet collection = new Collection();\ncollection.loadIconifyCollection('fa-solid');\ncollection.removeIcon('home');\n```\n\n### iconExists()\n\nChecks if an icon or an alias exists.\n\nFunction parameters:\n\n- `name` - icon name.\n\nReturns:\n\n- boolean - true or false\n\n```js\nif (!collection.iconExists('home')) {\n\tconsole.error('Missing \"home\" icon!');\n}\n```\n\n### listIcons()\n\nLists all icons in an icon set.\n\nFunction parameters:\n\n- `includeAliases` - set to true to include aliases in the result.\n\nReturns:\n\n- array - list of icons\n\n```js\nlet collection = new Collection();\ncollection.loadIconifyCollection('vaadin');\nconsole.log(\n\t'Available icons in vaadin collection:',\n\tcollection.listIcons(true)\n);\n```\n\n### Other functions\n\n#### items\n\nThis is a property, not a function. You can use it to have access to raw JSON data. Value is the same as using `getIcons()` without parameters.\n\n#### prefix()\n\nReturns the icon set prefix, `false` if the icon set has no prefix.\n\nReturns:\n\n- string|boolean - Prefix, `false` on error.\n\n```js\nlet prefix = collection.prefix();\n```\n\n#### findIconifyCollection()\n\nThis function locates Iconify icon set from [@iconify/json](https://github.com/iconify/collections-json) repository.\n\nFunction parameters:\n\n- `name` - Prefix of the icon set.\n- `dir` - Optional root directory where Iconify icon sets are stored. Use this option if you want to load Iconify icon set from a custom directory instead of the `@iconify/json` repository.\n\nReturns:\n\n- string - location of the file.\n\n```js\nconsole.log(\n\t'fa-solid.json can be found at',\n\tColleciton.findIconifyCollection('fa-solid')\n);\n```\n\n#### optimize()\n\nOptimize is a static function that optimizes JSON data. It modifies the object passed in the first parameter.\n\nFunction parameters:\n\n- `data` - JSON object to optimize.\n- `props` - an optional array of properties to optimize. If not set, default properties list will be used.\n\n```js\nlet data = JSON.parse(JSON.stringify(collection.getIcons()));\nCollection.optimize(data);\n```\n\n#### deOptimize()\n\nOpposite of the previous function. It converts optimized JSON data into full JSON data, making it easy to retrieve data for each icon.\n\nFunction parameters:\n\n- `data` - JSON object to de-optimize.\n\n```js\nlet data = JSON.parse(fs.readFileSync('ant-design.json', 'utf8'));\nCollection.deOptimize(data);\n```\n\n## SVG class\n\nThe `SVG` class generates code for the icon.\n\nTo include it use this code:\n\n```js\nconst SVG = require('@iconify/json-tools').SVG;\n```\n\nUsually it should be used with the `Collection` class, so include should look like this:\n\n```js\nconst { SVG, Collection } = require('@iconify/json-tools');\n```\n\n### Initializing class instance\n\n```js\nlet svg = new SVG(data);\n```\n\n### Getting SVG icon\n\nThe `SVG` class has one function: `getSVG()`. It returns SVG as a string.\n\n```js\nconst { SVG, Collection } = require('@iconify/json-tools');\n\nlet collection = new Collection();\ncollection.loadIconifyCollection('mdi');\nlet svg = new SVG(collection.getIconData('home'));\nconsole.log(svg.getSVG({}));\n```\n\n`getSVG()` has one parameter: custom properties object. Possible object attributes:\n\n- `inline` - if true or \"true\" or \"1\" (string or boolean), code will include `vertical-align` style, making it behave like a glyph. See [inline vs block article](https://iconify.design/docs/inline-vs-block/).\n- `width`, `height` - dimensions of icon. If only one attribute is set, another attribute will be set using icon's width/height ratio. Value can be string (such as \"1em\", \"24px\" or number). If value is \"auto\", icon's original dimensions will be used. If both width and height are not set, height defaults to \"1em\".\n- `hFlip`, `vFlip` - if true or \"true\" or \"1\" (string or boolean), icon will be flipped horizontally and/or vertically.\n- `flip` - alternative to \"hFlip\" and \"vFlip\", string. Value can be \"horizontal\", \"vertical\" or \"horizontal,vertical\"\n- `rotate` - rotation. Value can be in degrees \"90deg\" (only 90, 180 and 270 rotations are available), percentages \"25%\" (25%, 50% and 75% are aliases of 90deg, 180deg and 270deg) or number 1-3 (1 - 90deg, 2 - 180deg, 3 - 270deg).\n- `align` - alignment. This is useful if you have custom width and height set. Unlike other images, SVG keep aspect ratio (unless stated otherwise) when scaled. Value is comma or space separated string with possible strings (example: \"left,top,crop\"):\n  - `left`, `right`, `center` - horizontal alignment\n  - `top`, `middle`, `bottom` - vertical alignment\n  - `crop` - crop parts that go outside of boundaries\n  - `meet` - scale icon down to fit entire icon (opposite of crop)\n- `color` - custom color string to replace currentColor. This is useful when using icon as background image because background image cannot use currentColor\n- `box` - if true or \"true\" or \"1\" (string or boolean), icon will include extra rectangle matching its view box. This is useful to export icon to editor making icon easier to scale or place into its position in sketch because often editors ignore viewBox.\n\n```js\nsvg.getSVG({\n\theight: '24px',\n});\nsvg.getSVG({\n\theight: '24px',\n\twidth: '24px',\n\talign: 'center,middle,meet',\n\tcolor: '#ff8000',\n\trotate: '90deg', // same as \"rotate: 1\" or \"rotate: '25%'\"\n\tflip: 'horizontal', // same as \"hFlip: true\"\n\tbox: true,\n});\nsvg.getSVG({\n\theight: 'auto', // height and width will be set from viewBox attribute, using original icon's dimensions\n});\n```\n\n## License\n\nThe library is released with MIT license.\n\n© 2018 - 2020 Vjacheslav Trushkin\n","_attachments":{},"homepage":"https://github.com/iconify/json-tools.js","bugs":{"url":"https://github.com/iconify/json-tools.js/issues"},"license":"MIT"}