{"versions":{"1.0.0":{"name":"generate-code","version":"1.0.0","main":"lib/index.js","devDependencies":{"babel-cli":"^6.24.1","babel-preset-es2015":"^6.24.1","mocha":"^3.4.2"},"dependencies":{"lines-and-columns":"^1.1.6","lodash":"^4.17.4","merge-source-map":"^1.0.3","source-map":"^0.5.6","sourcemap-codec":"^1.3.1"},"scripts":{"build":"babel src --out-dir lib","test":"mocha test/index.js --reporter dot","prepublish":"npm test && npm run build"},"gitHead":"44ccd0933272a2b7ff517116d9dc8fcd4eb539fc","description":"The plugin exports a class that helps generate code and sourcemaps.","_id":"generate-code@1.0.0","_npmVersion":"5.0.0","_nodeVersion":"8.0.0","_npmUser":{"name":"anonymous","email":"danilvoronchikhin@gmail.com"},"dist":{"integrity":"sha512-UtpraABhNvQYAru+p2LYmEOG2s9JxhD38o0JCTYhQxkHX8YSzcYHgSR3Lezi2VxNhKhfbsG72qhkNmWxsoDpBQ==","shasum":"cbd32bd17f5ff83d525eac49afc5d653940c756a","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/generate-code/-/generate-code-1.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCJ+FnxYe4YJ8cPK7gCp1QjZw1hSRWygHMMToCwTpOWvgIgG1xVynJkTWNw/C4EZg0GDKHK14I90dgxr9nkgnVl29Q="}]},"maintainers":[{"name":"anonymous","email":"danilvoronchikhin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/generate-code-1.0.0.tgz_1497288699573_0.6869780633132905"},"directories":{},"contributors":[]},"2.0.0":{"name":"generate-code","version":"2.0.0","main":"lib/index.js","devDependencies":{"babel-cli":"^6.24.1","babel-preset-es2015":"^6.24.1","mocha":"^3.4.2"},"dependencies":{"lines-and-columns":"^1.1.6","lodash":"^4.17.4","merge-source-map":"^1.0.3","source-map":"^0.5.6","sourcemap-codec":"^1.3.1"},"scripts":{"build":"babel src --out-dir lib","test":"mocha test/index.js --reporter dot","prepublish":"npm test && npm run build"},"gitHead":"44ccd0933272a2b7ff517116d9dc8fcd4eb539fc","description":"The plugin exports a class that helps generate code and sourcemaps.","_id":"generate-code@2.0.0","_npmVersion":"5.0.0","_nodeVersion":"8.0.0","_npmUser":{"name":"anonymous","email":"danilvoronchikhin@gmail.com"},"dist":{"integrity":"sha512-NWcJ9cT2up1G9o07n8Xj2rqmloFvTprAy5UmRNAUg54M0L5NrjE7H2LbYLjFZAjCdZuEW8y7kVFjlifm4JbVdg==","shasum":"f2e02a5534ef96c6732e1ac6f4f3313705e37ca4","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/generate-code/-/generate-code-2.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDmMteGjzYxlBayNxtWnCMSw/2pYXiDSqR1ZdkjhNRliAiBW4iSzSxVrVr3MzuMcC2uElNlcObx5Jz1aUo+YF3Axig=="}]},"maintainers":[{"name":"anonymous","email":"danilvoronchikhin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/generate-code-2.0.0.tgz_1497346976065_0.8332662468310446"},"directories":{},"contributors":[]},"2.1.0":{"name":"generate-code","version":"2.1.0","main":"lib/index.js","devDependencies":{"babel-cli":"^6.24.1","babel-preset-es2015":"^6.24.1","mocha":"^3.4.2"},"dependencies":{"lines-and-columns":"^1.1.6","lodash":"^4.17.4","merge-source-map":"^1.0.3","source-map":"^0.5.6","sourcemap-codec":"^1.3.1"},"scripts":{"build":"babel src --out-dir lib","test":"mocha test/index.js --reporter dot","prepublish":"npm test && npm run build"},"gitHead":"44ccd0933272a2b7ff517116d9dc8fcd4eb539fc","description":"The plugin exports a class that helps generate code and sourcemaps.","_id":"generate-code@2.1.0","_npmVersion":"5.0.0","_nodeVersion":"8.0.0","_npmUser":{"name":"anonymous","email":"danilvoronchikhin@gmail.com"},"dist":{"integrity":"sha512-L9ulkmXWBJwTLuUieO6KUghhAto8NVDAhCLzN5R3Ik23Pc3ceQ0pxZDEu3lWAC+CJVX6ZmvthCUzIRXedkDnWQ==","shasum":"8f3642b09c39283fdbae48a6a5532d18af7ff921","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/generate-code/-/generate-code-2.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAnztFUb8NUbDJCFx2R/cENuua727KyqpKVQbn8nAN9jAiEAwgBJtXtvv2ufBCWLVnuBalsG/P7dxepOPJInTa/Ezng="}]},"maintainers":[{"name":"anonymous","email":"danilvoronchikhin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/generate-code-2.1.0.tgz_1497347027133_0.7527923381421715"},"directories":{},"contributors":[]},"2.2.0":{"name":"generate-code","version":"2.2.0","main":"lib/index.js","typings":"index.d.ts","devDependencies":{"babel-cli":"^6.24.1","babel-preset-es2015":"^6.24.1","mocha":"^3.4.2"},"dependencies":{"lines-and-columns":"^1.1.6","lodash":"^4.17.4","merge-source-map":"^1.0.3","source-map":"^0.5.6","sourcemap-codec":"^1.3.1"},"scripts":{"build":"babel src --out-dir lib","test":"mocha test/index.js --reporter dot","prepublish":"npm test && npm run build"},"gitHead":"5fa47c9a57e348f237c5518ceb64a4ea09bb0c35","description":"The plugin exports a class that helps generate code and sourcemaps.","_id":"generate-code@2.2.0","_npmVersion":"5.0.0","_nodeVersion":"8.0.0","_npmUser":{"name":"anonymous","email":"danilvoronchikhin@gmail.com"},"dist":{"integrity":"sha512-CNXIzGTl6+OYoDjkI4N+yYUoSYu5dgSGFiyDteGzte9lXzPUQBCm/SxGlwx3suQwE5dFG9ME2RtfQEVUi3XF8g==","shasum":"4fe1ad7d291ada4230c3a0184845c81f69884be9","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/generate-code/-/generate-code-2.2.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCNQLJvc0JYF/HpmNbuDepr6kwxx9him6EHC2Yfs279ewIgFfKfYTZc0h7Kurq5KHEQPk73OwAQjxx6GkGyUTZB4Jc="}]},"maintainers":[{"name":"anonymous","email":"danilvoronchikhin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/generate-code-2.2.0.tgz_1497347875136_0.35843585222028196"},"directories":{},"contributors":[]},"2.2.1":{"name":"generate-code","version":"2.2.1","main":"lib/index.js","typings":"index.d.ts","devDependencies":{"babel-cli":"^6.24.1","babel-preset-es2015":"^6.24.1","mocha":"^3.4.2"},"dependencies":{"lines-and-columns":"^1.1.6","lodash":"^4.17.4","merge-source-map":"^1.0.3","source-map":"^0.5.6","sourcemap-codec":"^1.3.1"},"scripts":{"build":"babel src --out-dir lib","test":"mocha test/index.js --reporter dot","prepublish":"npm test && npm run build"},"gitHead":"5fa47c9a57e348f237c5518ceb64a4ea09bb0c35","description":"The plugin exports a class that helps generate code and sourcemaps.","_id":"generate-code@2.2.1","_npmVersion":"5.0.0","_nodeVersion":"8.0.0","_npmUser":{"name":"anonymous","email":"danilvoronchikhin@gmail.com"},"dist":{"integrity":"sha512-aUZTEKfx1fFUp6WwAuLqq50TV34YcFrrbow44bhtQOtCFfbxaVogupxCfW1waYQ/DLvpGc0Xdh8ljTyEp9o91Q==","shasum":"d87cc405008717e7447ac4a67229319fee137fcb","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/generate-code/-/generate-code-2.2.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEW3dOfOT2FUDALKF8pg6HdMqMY+0r7pszTgjx8+DSPlAiEApGtEaeDHAJRxsjC+Cndjrv733Os75RKclunfmw2+OHA="}]},"maintainers":[{"name":"anonymous","email":"danilvoronchikhin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/generate-code-2.2.1.tgz_1497348025788_0.36159437522292137"},"directories":{},"contributors":[]},"2.2.2":{"name":"generate-code","version":"2.2.2","main":"lib/index.js","typings":"index.d.ts","devDependencies":{"babel-cli":"^6.24.1","babel-preset-es2015":"^6.24.1","mocha":"^3.4.2"},"dependencies":{"lines-and-columns":"^1.1.6","lodash":"^4.17.4","merge-source-map":"^1.0.3","source-map":"^0.5.6","sourcemap-codec":"^1.3.1"},"scripts":{"build":"babel src --out-dir lib","test":"mocha test/index.js --reporter dot","prepublish":"npm test && npm run build"},"gitHead":"123d1bb73593ca407bc24e190d03bec47787b66f","description":"The plugin exports a class that helps generate code and sourcemaps.","_id":"generate-code@2.2.2","_npmVersion":"5.0.0","_nodeVersion":"8.0.0","_npmUser":{"name":"anonymous","email":"danilvoronchikhin@gmail.com"},"dist":{"integrity":"sha512-1zB/KHYUdcqlQM3wHaT3JtyxpKVcX96EvAueKCyhUHKjeoxPcYoueyyJ6BwuQLsSUM37XC23YnPLuewRhlwDiQ==","shasum":"54c89fe60593d274cac5a402fc155c0a3a88e55b","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/generate-code/-/generate-code-2.2.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDtWIgGm52TQeJLHvCZPaqVUCUSWfysaV8gxIM8H/ILtQIhALPXLn2Z4fB/o9T362dbZYh0OdEYVqJFQJDhcsiSM+xu"}]},"maintainers":[{"name":"anonymous","email":"danilvoronchikhin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/generate-code-2.2.2.tgz_1497456584169_0.13068396458402276"},"directories":{},"contributors":[]},"2.3.0":{"name":"generate-code","version":"2.3.0","main":"lib/index.js","typings":"index.d.ts","devDependencies":{"babel-cli":"^6.24.1","babel-preset-es2015":"^6.24.1","mocha":"^3.4.2"},"dependencies":{"lines-and-columns":"^1.1.6","lodash":"^4.17.4","merge-source-map":"^1.0.3","source-map":"^0.5.6","sourcemap-codec":"^1.3.1"},"scripts":{"build":"babel src --out-dir lib","test":"mocha test/index.js --reporter dot","prepublish":"npm test && npm run build"},"gitHead":"2d8c80b2f7b74ed93fdc92444c24dc38211ba257","description":"The plugin exports a class that helps generate code and sourcemaps.","_id":"generate-code@2.3.0","_npmVersion":"5.0.3","_nodeVersion":"8.0.0","_npmUser":{"name":"anonymous","email":"danilvoronchikhin@gmail.com"},"dist":{"integrity":"sha512-D9y8s0CfKOXRBbJjWSw4HAVKVOzPaP2jIOIYcTXCGFTKEe/71EzMTTUrkpAsqrHCK8nYfL89qnfkMcxgxoKOcw==","shasum":"b3c4b45c63d907d0eb05e08bb203a29f820ec014","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/generate-code/-/generate-code-2.3.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCmCxW96aYQ0sffs4P81EinCyNzBGEFXyhsgF7592ErpAIgBdB5BcvYKlDu2AcXkDUoCRPekr8uJltmTk+7Heowdcc="}]},"maintainers":[{"name":"anonymous","email":"danilvoronchikhin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/generate-code-2.3.0.tgz_1498054799200_0.8530578031204641"},"directories":{},"contributors":[]},"2.3.1":{"name":"generate-code","version":"2.3.1","main":"lib/index.js","typings":"index.d.ts","devDependencies":{"babel-cli":"^6.24.1","babel-preset-es2015":"^6.24.1","mocha":"^3.4.2"},"dependencies":{"lines-and-columns":"^1.1.6","lodash":"^4.17.4","merge-source-map":"^1.0.3","source-map":"^0.5.6","sourcemap-codec":"^1.3.1"},"scripts":{"build":"babel src --out-dir lib","test":"mocha test/index.js --reporter dot","prepublish":"npm test && npm run build"},"gitHead":"aa8fd3d124283249a4fe01ab1b40af8f077a2bde","description":"The plugin exports a class that helps generate code and sourcemaps.","_id":"generate-code@2.3.1","_npmVersion":"5.0.3","_nodeVersion":"8.0.0","_npmUser":{"name":"anonymous","email":"danilvoronchikhin@gmail.com"},"dist":{"integrity":"sha512-Q/nbkrkndG48IaL1XAW3ahKT7yTZbug/sHRmewA5TRGUDf7SDIrKfo+UXkzH81ioBBrYuclUWYBqg8H6MhD+AA==","shasum":"940f38a62e9fdfcf85c2ad868f5175218f31790e","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/generate-code/-/generate-code-2.3.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBNr5nG44KMttLigVT4ESkPILXPqtf5H7V7bJQDKmzAtAiBy+2A0MdDf4q8fEY6DENcEtPGt1is+MpEUZObynnu4RQ=="}]},"maintainers":[{"name":"anonymous","email":"danilvoronchikhin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/generate-code-2.3.1.tgz_1498745732543_0.8078025358263403"},"directories":{},"contributors":[]},"2.3.2":{"name":"generate-code","version":"2.3.2","main":"lib/index.js","typings":"index.d.ts","devDependencies":{"babel-cli":"^6.24.1","babel-preset-es2015":"^6.24.1","mocha":"^3.4.2"},"dependencies":{"lines-and-columns":"^1.1.6","lodash":"^4.17.4","merge-source-map":"^1.0.3","source-map":"^0.5.6","sourcemap-codec":"^1.3.1"},"scripts":{"build":"babel src --out-dir lib","test":"mocha test/index.js --reporter dot","prepublish":"npm test && npm run build"},"gitHead":"f97ca55747f0fb166d7faff500749d73bd06b6e5","description":"The plugin exports a class that helps generate code and sourcemaps.","_id":"generate-code@2.3.2","_npmVersion":"5.0.3","_nodeVersion":"8.0.0","_npmUser":{"name":"anonymous","email":"danilvoronchikhin@gmail.com"},"dist":{"integrity":"sha512-scv9PtMdw1kYAFcy0pXMFYTL3SNLoz4owutB3gF6Z34Kga4oIWe3MJc8VBsq88eZjFPCQHkHAgqrGvgGp+hvAA==","shasum":"d44df56437fc706feca195a80f1dfd42c83c7d75","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/generate-code/-/generate-code-2.3.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDEbU+pEgaV/Pr9iyOPfrJL3nrvRjRmscQSoLd2gXZB3gIhAJrNW1PmufTh+2TLRNx60sZ963BrOjLOt9LyAXDnIFsQ"}]},"maintainers":[{"name":"anonymous","email":"danilvoronchikhin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/generate-code-2.3.2.tgz_1498746169401_0.16552885179407895"},"directories":{},"contributors":[]}},"dist-tags":{"latest":"2.3.2"},"name":"generate-code","time":{"modified":"2022-01-26T17:20:45.485Z","created":"2022-01-26T17:20:45.485Z","1.0.0":"2017-06-12T17:31:40.501Z","2.0.0":"2017-06-13T09:42:56.930Z","2.1.0":"2017-06-13T09:43:48.626Z","2.2.0":"2017-06-13T09:57:55.978Z","2.2.1":"2017-06-13T10:00:26.614Z","2.2.2":"2017-06-14T16:09:45.048Z","2.3.0":"2017-06-21T14:20:00.194Z","2.3.1":"2017-06-29T14:15:33.412Z","2.3.2":"2017-06-29T14:22:50.319Z"},"readme":"# generate-code\n\nThe plugin exports a class that helps generate code and sourcemaps.\n\n### Installation\n\n```bash\nnpm install --save generate-code\n```\n\n### Usage\n\n```js\nconst CodeGenerator = require('generate-code');\n\nconst code = new CodeGenerator(options);\n\ncode.add('var a, b;\\n');\ncode.addWithMapping(\n  'var c;',\n  { line: 1, column: 10 },\n  'c'\n);\n\nconst generatedCode = code.toString();\n\n// var a, b;\n// var c;\n\nconst generatedMap = code.generateMap();\n\n// {\n//   version: 3,\n//   ...\n// }\n```\n\n### API\n\n##### CodeGenerator\n\n```\nnew CodeGenerator(options: Options)\n```\n\n* `options.filename` (required): filename for the sourcemap.\n* `options.sourceContent` (required): source content for the sourcemap.\n* `options.sourceMap` (default: `true`): if it is needed to generate\na sourcemap.\n* `options.inputSourceMap` (default: `null`): input sourcemap.\n\n##### CodeGenerator#add\n\n```\nadd(chunk: string): this\n```\n\nAdds a `chunk` of code to the generated code.\n\nExample:\n\n```js\ncode.add('fun(1, 2);');\n```\n\n##### CodeGenerator#addWithMap\n\n```\naddWithMap(\n  chunk: string,\n  map: SourceMap,\n  position?: { line: number, column: number } | number\n): this\n```\n\nApplies the `map` to the existing map (shifting it according to the\ncurrent position in the generated code) and then adds the `chunk`\nof code.\n\nThird optional parameter is the position of the mappings relatively\nto the source. Can be a number or a `{ line, column }` object with\n0-indexed line.\n\nExample:\n\n```js\nconst code = new CodeGenerator({\n  filename: 'index.js',\n  sourceContent: `var a = 10;\nvar b = {\n  c: 1,\n  d: 2\n};\nvar c = [];`\n});\n\ncode.add(`var a = 10;\nvar b = `);\n\nconst {\n  code: generated,\n  map\n} = addUnderscoreToProps(`{\n  c: 1,\n  d: 2\n}`);\n\ncode.addWithMap(\n  generated,\n  map,\n  { line: 1, column: 8 } // where '{' is located\n);\ncode.add(`;\nvar c = [];`);\n\nconsole.log(code.toString());\n\n// var a = 10;\n// var b = {\n//   _c: 1,\n//   _d: 2,\n// };\n```\n\n##### CodeGenerator#addWithMapping\n\n```\naddWithMapping(\n  chunk: string,\n  position?: { line: number, column: number } | number,\n  name?: string\n): this\n```\n\nApplies the mapping to the existing map (shifting it according to the\ncurrent position in the generated code) and then adds the `chunk`\nof code.\n\nSecond optional parameter is the position of the mapping relatively\nto the source. Can be a number or a `{ line, column }` object with\n0-indexed line.\n\nThird optional argument describes the mapping name.\n\nExample:\n\n```js\nconst code = new CodeGenerator({\n  filename: 'index.js',\n  sourceContent: `var a = 10;\nvar b = {\n  c: 1,\n  d: 2\n};\nvar c = [];`\n});\n\ncode.add(`var a = 10;\nvar b = {\n  `);\n\ncode.addWithMapping(\n  '_c',\n  { line: 2, column: 2 }, // where 'c' is located\n  'c'\n);\n\ncode.add(`: 1,\n  `);\n\ncode.addWithMapping(\n  '_d',\n  { line: 3, column: 2 }, // where 'd' is located\n  'd'\n);\n\ncode.add(`: 2\n};\nvar c = [];`);\n\nconsole.log(code.toString());\n\n// var a = 10;\n// var b = {\n//   _c: 1,\n//   _d: 2,\n// };\n```\n\n##### CodeGenerator#getCurrentIndent()\n\n```\ngetCurrentIndent(): string\n```\n\nReturns current code indent.\n\nExample:\n\n```js\nconst code = new CodeGenerator({\n  filename: 'index.js',\n  sourceContent: 'abc'\n});\n\ncode.add('\\na');\n\ncode.toString();         // '\\na'\ncode.getCurrentIndent(); // ''\n\ncode.add('\\n  b');\n\ncode.toString();         // '\\na\\n  b'\ncode.getCurrentIndent(); // '  '\n\ncode.add('\\n\\tc');\n\ncode.toString();         // '\\na\\n  b\\n\\tc'\ncode.getCurrentIndent(); // '\\t'\n```\n\n##### CodeGenerator#toString()\n\n```\ntoString(): string\n```\n\nReturns the generated code.\n\n##### CodeGenerator#generateMap()\n\n```\ngenerateMap(): SourceMap\n```\n\nReturns the generated sourcemap.","users":{}}