{"_id":"esindent","_rev":"160981","name":"esindent","description":"ECMAScript code indenter based on Esprima AST and Rocambole","dist-tags":{"latest":"0.4.3"},"maintainers":[{"name":"millermedeiros","email":""}],"time":{"modified":"2021-06-03T11:40:10.000Z","created":"2013-12-09T17:54:55.102Z","0.4.3":"2013-12-16T16:00:43.028Z","0.4.2":"2013-12-15T04:20:22.093Z","0.4.1":"2013-12-15T03:51:14.553Z","0.4.0":"2013-12-14T15:29:58.728Z","0.3.1":"2013-12-13T20:54:12.041Z","0.3.0":"2013-12-13T20:10:47.458Z","0.2.0":"2013-12-12T21:27:44.353Z","0.1.0":"2013-12-09T17:54:55.102Z"},"users":{},"author":{"name":"Miller Medeiros","email":"contact@millermedeiros.com","url":"http://blog.millermedeiros.com"},"repository":{"type":"git","url":"https://github.com/millermedeiros/esindent.git"},"versions":{"0.4.3":{"name":"esindent","version":"0.4.3","description":"ECMAScript code indenter based on Esprima AST and Rocambole","main":"lib/esindent.js","directories":{"test":"test"},"scripts":{"test":"node test/runner.js","lint":"jshint lib/*.js test/*.js"},"repository":{"type":"git","url":"https://github.com/millermedeiros/esindent.git"},"keywords":["indent","code","esprima","esformatter","rocambole","ast","javascript","ecmascript","formatter"],"author":{"name":"Miller Medeiros","email":"contact@millermedeiros.com","url":"http://blog.millermedeiros.com"},"license":"MIT","bugs":{"url":"https://github.com/millermedeiros/esindent/issues"},"homepage":"https://github.com/millermedeiros/esindent","dependencies":{"rocambole":"~0.3","rocambole-token":"~1.0","rocambole-node":"~1.0","mout":"~0.8.0"},"devDependencies":{"mocha":"https://github.com/millermedeiros/mocha/tarball/latest","chai":"~1.8.1","glob":"~3.2.7","jshint":"~2.3.0"},"jshintConfig":{"node":true,"eqnull":true,"boss":true,"undef":true,"unused":true,"latedef":false},"readmeFilename":"README.md","_id":"esindent@0.4.3","dist":{"shasum":"6a6b48189d2a25abdef506b448e52732cb7787ab","size":9122,"noattachment":false,"key":"/esindent/-/esindent-0.4.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/esindent/download/esindent-0.4.3.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"millermedeiros","email":"miller@millermedeiros.com"},"maintainers":[{"name":"millermedeiros","email":""}],"deprecated":"use esformatter instead, since this project is not maintained anymore","publish_time":1387209643028,"_hasShrinkwrap":false,"_cnpm_publish_time":1387209643028},"0.4.2":{"name":"esindent","version":"0.4.2","description":"ECMAScript code indenter based on Esprima AST and Rocambole","main":"lib/esindent.js","directories":{"test":"test"},"scripts":{"test":"node test/runner.js","lint":"jshint lib/*.js test/*.js"},"repository":{"type":"git","url":"https://github.com/millermedeiros/esindent.git"},"keywords":["indent","code","esprima","esformatter","rocambole","ast","javascript","ecmascript","formatter"],"author":{"name":"Miller Medeiros","email":"contact@millermedeiros.com","url":"http://blog.millermedeiros.com"},"license":"MIT","bugs":{"url":"https://github.com/millermedeiros/esindent/issues"},"homepage":"https://github.com/millermedeiros/esindent","dependencies":{"rocambole":"~0.3","rocambole-token":"~1.0","rocambole-node":"~1.0","mout":"~0.8.0"},"devDependencies":{"mocha":"https://github.com/millermedeiros/mocha/tarball/latest","chai":"~1.8.1","glob":"~3.2.7","jshint":"~2.3.0"},"jshintConfig":{"node":true,"eqnull":true,"boss":true,"undef":true,"unused":true,"latedef":false},"readmeFilename":"README.md","_id":"esindent@0.4.2","dist":{"shasum":"f1913c618c2420b63315afdf42b8ecd9d3bef367","size":8859,"noattachment":false,"key":"/esindent/-/esindent-0.4.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/esindent/download/esindent-0.4.2.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"millermedeiros","email":"miller@millermedeiros.com"},"maintainers":[{"name":"millermedeiros","email":""}],"publish_time":1387081222093,"_cnpm_publish_time":1387081222093,"deprecated":"use esformatter instead, since this project is not maintained anymore","_hasShrinkwrap":false},"0.4.1":{"name":"esindent","version":"0.4.1","description":"ECMAScript code indenter based on Esprima AST and Rocambole","main":"lib/esindent.js","directories":{"test":"test"},"scripts":{"test":"node test/runner.js","lint":"jshint lib/*.js test/*.js"},"repository":{"type":"git","url":"https://github.com/millermedeiros/esindent.git"},"keywords":["indent","code","esprima","esformatter","rocambole","ast","javascript","ecmascript","formatter"],"author":{"name":"Miller Medeiros","email":"contact@millermedeiros.com","url":"http://blog.millermedeiros.com"},"license":"MIT","bugs":{"url":"https://github.com/millermedeiros/esindent/issues"},"homepage":"https://github.com/millermedeiros/esindent","dependencies":{"rocambole":"~0.2.3","rocambole-token":"~1.0","rocambole-node":"~1.0","mout":"~0.8.0"},"devDependencies":{"mocha":"https://github.com/millermedeiros/mocha/tarball/latest","chai":"~1.8.1","glob":"~3.2.7","jshint":"~2.3.0"},"jshintConfig":{"node":true,"eqnull":true,"boss":true,"undef":true,"unused":true,"latedef":false},"readmeFilename":"README.md","_id":"esindent@0.4.1","dist":{"shasum":"d2a9fa0ec218a74f73130e7f2aecea6895e1c336","size":8999,"noattachment":false,"key":"/esindent/-/esindent-0.4.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/esindent/download/esindent-0.4.1.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"millermedeiros","email":"miller@millermedeiros.com"},"maintainers":[{"name":"millermedeiros","email":""}],"publish_time":1387079474553,"_cnpm_publish_time":1387079474553,"deprecated":"use esformatter instead, since this project is not maintained anymore","_hasShrinkwrap":false},"0.4.0":{"name":"esindent","version":"0.4.0","description":"ECMAScript code indenter based on Esprima AST and Rocambole","main":"lib/esindent.js","directories":{"test":"test"},"scripts":{"test":"node test/runner.js","lint":"jshint lib/*.js test/*.js"},"repository":{"type":"git","url":"https://github.com/millermedeiros/esindent.git"},"keywords":["indent","code","esprima","esformatter","rocambole","ast","javascript","ecmascript","formatter"],"author":{"name":"Miller Medeiros","email":"contact@millermedeiros.com","url":"http://blog.millermedeiros.com"},"license":"MIT","bugs":{"url":"https://github.com/millermedeiros/esindent/issues"},"homepage":"https://github.com/millermedeiros/esindent","dependencies":{"rocambole":"~0.2.3","rocambole-token":"~1.0","rocambole-node":"~1.0","mout":"~0.8.0"},"devDependencies":{"mocha":"https://github.com/millermedeiros/mocha/tarball/latest","chai":"~1.8.1","glob":"~3.2.7","jshint":"~2.3.0"},"jshintConfig":{"node":true,"eqnull":true,"boss":true,"undef":true,"unused":true,"latedef":false},"readmeFilename":"README.md","_id":"esindent@0.4.0","dist":{"shasum":"39ef59c16cf00f82f65241a592c06e7ce2474654","size":9030,"noattachment":false,"key":"/esindent/-/esindent-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/esindent/download/esindent-0.4.0.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"millermedeiros","email":"miller@millermedeiros.com"},"maintainers":[{"name":"millermedeiros","email":""}],"publish_time":1387034998728,"_cnpm_publish_time":1387034998728,"deprecated":"use esformatter instead, since this project is not maintained anymore","_hasShrinkwrap":false},"0.3.1":{"name":"esindent","version":"0.3.1","description":"ECMAScript code indenter based on Esprima AST and Rocambole","main":"lib/esindent.js","directories":{"test":"test"},"scripts":{"test":"node test/runner.js","lint":"jshint lib/*.js test/*.js"},"repository":{"type":"git","url":"https://github.com/millermedeiros/esindent.git"},"keywords":["indent","code","esprima","esformatter","rocambole","ast","javascript","ecmascript","formatter"],"author":{"name":"Miller Medeiros","email":"contact@millermedeiros.com","url":"http://blog.millermedeiros.com"},"license":"MIT","bugs":{"url":"https://github.com/millermedeiros/esindent/issues"},"homepage":"https://github.com/millermedeiros/esindent","dependencies":{"rocambole":"~0.2.3","rocambole-token":"~1.0","rocambole-node":"~1.0","mout":"~0.8.0"},"devDependencies":{"mocha":"https://github.com/millermedeiros/mocha/tarball/latest","chai":"~1.8.1","glob":"~3.2.7","jshint":"~2.3.0"},"jshintConfig":{"node":true,"eqnull":true,"boss":true,"undef":true,"unused":true,"latedef":false},"readmeFilename":"README.md","_id":"esindent@0.3.1","dist":{"shasum":"1184cc4c11e82482c71c09d4735f068422b633ef","size":7857,"noattachment":false,"key":"/esindent/-/esindent-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/esindent/download/esindent-0.3.1.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"millermedeiros","email":"miller@millermedeiros.com"},"maintainers":[{"name":"millermedeiros","email":""}],"publish_time":1386968052041,"_cnpm_publish_time":1386968052041,"deprecated":"use esformatter instead, since this project is not maintained anymore","_hasShrinkwrap":false},"0.3.0":{"name":"esindent","version":"0.3.0","description":"ECMAScript code indenter based on Esprima AST and Rocambole","main":"lib/esindent.js","directories":{"test":"test"},"scripts":{"test":"node test/runner.js","lint":"jshint lib/*.js test/*.js"},"repository":{"type":"git","url":"https://github.com/millermedeiros/esindent.git"},"keywords":["indent","code","esprima","esformatter","rocambole","ast","javascript","ecmascript","formatter"],"author":{"name":"Miller Medeiros","email":"contact@millermedeiros.com","url":"http://blog.millermedeiros.com"},"license":"MIT","bugs":{"url":"https://github.com/millermedeiros/esindent/issues"},"homepage":"https://github.com/millermedeiros/esindent","dependencies":{"rocambole":"~0.2.3","rocambole-token":"~1.0","rocambole-node":"~1.0","mout":"~0.8.0"},"devDependencies":{"mocha":"https://github.com/millermedeiros/mocha/tarball/latest","chai":"~1.8.1","glob":"~3.2.7","jshint":"~2.3.0"},"jshintConfig":{"node":true,"eqnull":true,"boss":true,"undef":true,"unused":true,"latedef":false},"readmeFilename":"README.md","_id":"esindent@0.3.0","dist":{"shasum":"c359c8dc91088e71e4370f53f1d979f2b6ebb4e9","size":7454,"noattachment":false,"key":"/esindent/-/esindent-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/esindent/download/esindent-0.3.0.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"millermedeiros","email":"miller@millermedeiros.com"},"maintainers":[{"name":"millermedeiros","email":""}],"publish_time":1386965447458,"_cnpm_publish_time":1386965447458,"deprecated":"use esformatter instead, since this project is not maintained anymore","_hasShrinkwrap":false},"0.2.0":{"name":"esindent","version":"0.2.0","description":"ECMAScript code indenter based on Esprima AST and Rocambole","main":"lib/esindent.js","directories":{"test":"test"},"scripts":{"test":"node test/runner.js"},"repository":{"type":"git","url":"https://github.com/millermedeiros/esindent.git"},"keywords":["indent","code","esprima","esformatter","rocambole","ast","javascript","ecmascript","formatter"],"author":{"name":"Miller Medeiros","email":"contact@millermedeiros.com","url":"http://blog.millermedeiros.com"},"license":"MIT","bugs":{"url":"https://github.com/millermedeiros/esindent/issues"},"homepage":"https://github.com/millermedeiros/esindent","dependencies":{"rocambole":"~0.2.3","rocambole-token":"~1.0","rocambole-node":"~1.0","mout":"~0.8.0"},"devDependencies":{"mocha":"https://github.com/millermedeiros/mocha/tarball/latest","chai":"~1.8.1","glob":"~3.2.7"},"jshintConfig":{"node":true,"eqnull":true},"readmeFilename":"README.md","_id":"esindent@0.2.0","dist":{"shasum":"9e7fce8f50537c2c69bc463204011084584968c7","size":6748,"noattachment":false,"key":"/esindent/-/esindent-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/esindent/download/esindent-0.2.0.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"millermedeiros","email":"miller@millermedeiros.com"},"maintainers":[{"name":"millermedeiros","email":""}],"publish_time":1386883664353,"_cnpm_publish_time":1386883664353,"deprecated":"use esformatter instead, since this project is not maintained anymore","_hasShrinkwrap":false},"0.1.0":{"name":"esindent","version":"0.1.0","description":"ECMAScript code indenter based on Esprima AST and Rocambole","main":"lib/esindent.js","directories":{"test":"test"},"scripts":{"test":"istanbul test test/runner.js"},"repository":{"type":"git","url":"https://github.com/millermedeiros/esindent.git"},"keywords":["indent","code","esprima","esformatter","rocambole","ast","javascript","ecmascript","formatter"],"author":{"name":"Miller Medeiros","email":"contact@millermedeiros.com","url":"http://blog.millermedeiros.com"},"license":"MIT","bugs":{"url":"https://github.com/millermedeiros/esindent/issues"},"homepage":"https://github.com/millermedeiros/esindent","dependencies":{"rocambole":"~0.2.3"},"devDependencies":{"mocha":"https://github.com/millermedeiros/mocha/tarball/latest","istanbul":"~0.1.46","chai":"~1.8.1"},"jshintConfig":{"node":true,"eqnull":true},"readmeFilename":"README.md","_id":"esindent@0.1.0","dist":{"shasum":"dd4ae7648c1192f4331bc6135ab329e029416ce1","size":3995,"noattachment":false,"key":"/esindent/-/esindent-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/esindent/download/esindent-0.1.0.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"millermedeiros","email":"miller@millermedeiros.com"},"maintainers":[{"name":"millermedeiros","email":""}],"publish_time":1386611695102,"_cnpm_publish_time":1386611695102,"deprecated":"use esformatter instead, since this project is not maintained anymore","_hasShrinkwrap":false}},"readme":"# esindent\n\nECMAScript code indenter based on Esprima AST\n\n**work in progress**\n\n---\n\n## Why?\n\nThis project started as an experiment while trying to [decouple the indent\nlogic from the other token manipulations on\nesformatter](https://github.com/millermedeiros/esformatter/issues/96). It's an\nattempt at finding a simpler solution to the problem while still maintaining\nthe flexibility.\n\nBy building it as a separate tool it is also simpler to reuse it for other\nprojects and will make some of the tests simpler to write (since we can test\nthe indentation separately).\n\n\n## How?\n\nThis tool uses a rocambole generated AST to traverse tokens inside each node\nand add/remove indent based on the node type.\n\nThe algorithm is very straightforward, it simple loops through all nodes\n(starting from the leaf) up to the program root, scanning each line start for\n`WhiteSpace` and adding/removing/editing `Indent` tokens as needed.\n\n\n## Goals\n\n - Indent based on syntax (not tokens).\n - Options to toggle behavior.\n - Be able to indent any JavaScript program!\n\n\n## API\n\n### esindent.transform(ast[, opts]):AST\n\nTransforms AST in-place, adding `Indent` tokens at the beginning of each line\nthat needs indentation.\n\n```js\nvar esi = require('esindent');\nesi.transform(ast, {\n  value: '  ',\n  ArrayExpression: 1,\n  BlockStatement: 1,\n  ChainedMemberExpression: 1,\n  MultipleVariableDeclaration: 1,\n  ObjectExpression: 1,\n  SwitchCase: 1,\n  SwitchStatement: 1,\n  EmptyStatement: 0\n});\n\n// to get the result as a string simply call ast.toString()\nconsole.log( ast.toString() );\n```\n\n\n## License\n\nReleased under the MIT License\n\n","_attachments":{},"readmeFilename":"README.md","homepage":"https://github.com/millermedeiros/esindent","bugs":{"url":"https://github.com/millermedeiros/esindent/issues"},"license":"MIT"}