{"_id":"path-segments","_rev":"65984","name":"path-segments","description":"Get n specific segments of a file path, e.g. first 2, last 3, etc.","dist-tags":{"latest":"0.1.1"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2021-06-03T10:22:06.000Z","created":"2014-06-26T04:01:35.303Z","0.1.1":"2014-06-26T04:03:05.582Z","0.1.0":"2014-06-26T04:01:35.303Z"},"users":{"tunnckocore":true},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/path-segments.git"},"versions":{"0.1.1":{"name":"path-segments","description":"Get n specific segments of a file path, e.g. first 2, last 3, etc.","version":"0.1.1","homepage":"https://github.com/jonschlinkert/path-segments","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/path-segments.git"},"bugs":{"url":"https://github.com/jonschlinkert/path-segments/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/path-segments/blob/master/LICENSE-MIT"}],"keywords":["docs","documentation","generate","generator","markdown","templates","verb"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"devDependencies":{"verb":"~0.2.6","chai":"~1.9.1","mocha":"*"},"dependencies":{"lodash":"^2.4.1","parse-filepath":"^0.3.0"},"_id":"path-segments@0.1.1","_shasum":"ff908ddf8577e77f6ada4831528ac2283c1527c8","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"ff908ddf8577e77f6ada4831528ac2283c1527c8","size":3543,"noattachment":false,"key":"/path-segments/-/path-segments-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/path-segments/download/path-segments-0.1.1.tgz"},"directories":{},"publish_time":1403755385582,"_cnpm_publish_time":1403755385582,"_hasShrinkwrap":false},"0.1.0":{"name":"path-segments","description":"Get specific segments of a file path. First, last, last two, first two, etc.","version":"0.1.0","homepage":"https://github.com/jonschlinkert/path-segments","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/path-segments.git"},"bugs":{"url":"https://github.com/jonschlinkert/path-segments/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/path-segments/blob/master/LICENSE-MIT"}],"keywords":["docs","documentation","generate","generator","markdown","templates","verb"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"devDependencies":{"verb":"~0.2.6","chai":"~1.9.1","mocha":"*"},"dependencies":{"lodash":"^2.4.1","parse-filepath":"^0.3.0"},"_id":"path-segments@0.1.0","_shasum":"2308091fc973eeca683f4ea4a96c106fd9d6eb28","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"2308091fc973eeca683f4ea4a96c106fd9d6eb28","size":3528,"noattachment":false,"key":"/path-segments/-/path-segments-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/path-segments/download/path-segments-0.1.0.tgz"},"directories":{},"publish_time":1403755295303,"_cnpm_publish_time":1403755295303,"_hasShrinkwrap":false}},"readme":"# path-segments [![NPM version](https://badge.fury.io/js/path-segments.png)](http://badge.fury.io/js/path-segments)\n\n> Get specific segments of a file path. First, last, last two, first two, etc.\n\n## Install\nInstall with [npm](npmjs.org):\n\n```bash\nnpm i path-segments --save-dev\n```\n\n## Usage\n\n```js\nvar segements = require('path-segments');\n```\n\n## Tests\n\nIn the command line, run `npm test` or `mocha`.\n\n\n### first\n\nGet the first `n` segments of a path:\n\n```js\nsegments('a/b/c', {first: 1});\n//=> 'a'\nsegments('./a/b/c', {first: 1});\n//=> 'a'\nsegments('/a/b/c.js', {first: 1});\n//=> 'a'\nsegments('/a/b/c/', {first: 1});\n//=> 'a'\nsegments('a\\\\b\\\\c', {first: 1});\n//=> 'a'\nsegments('.\\\\a\\\\b\\\\c.js', {first: 1});\n//=> 'a'\nsegments('.\\\\a\\\\b\\\\c\\\\', {first: 2});\n//=> 'a/b'\nsegments('.\\\\a\\\\b\\\\c.js', {first: 2});\n//=> 'a/b'\nsegments('/a/b/c.js', {first: 3});\n//=> 'a/b/c.js'\nsegments('/a/b/c/', {first: 3});\n//=> 'a/b/c'\nsegments('a\\\\b\\\\c', {first: 3});\n//=> 'a/b/c'\nsegments('a\\\\b\\\\c\\\\', {first: 3});\n//=> 'a/b/c'\nsegments('.\\\\a\\\\b\\\\c.js', {first: 3});\n//=> 'a/b/c.js'\n```\n\n### last\n\nGet the last `n` segments of a path:\n\n```js\nsegments('a/b/c');\n//=> 'c'\nsegments('./a/b/c');\n//=> 'c'\nsegments('./a/b/c.js');\n//=> 'c.js'\nsegments('/a/b/c.js');\n//=> 'c.js'\nsegments('/a/b/c/');\n//=> 'c'\nsegments('.\\\\a\\\\b\\\\c\\\\');\n//=> 'c'\nsegments('.\\\\a\\\\b\\\\c.js');\n//=> 'c.js'\nsegments('/a/b/c.js', {last: 2});\n//=> 'b/c.js'\nsegments('/a/b/c/', {last: 2});\n//=> 'b/c'\nsegments('a\\\\b\\\\c', {last: 2});\n//=> 'b/c'\nsegments('.\\\\a\\\\b\\\\c.js', {last: 2});\n//=> 'b/c.js'\nsegments('./a/b/c/', {last: 3});\n//=> 'a/b/c'\nsegments('a/b/c.js', {last: 3});\n//=> 'a/b/c.js'\nsegments('.\\\\a\\\\b\\\\c\\\\', {last: 3});\n//=> 'a/b/c'\nsegments('.\\\\a\\\\b\\\\c.js', {last: 3});\n//=> 'a/b/c.js'\n```\n\nSee [the tests](./test/test.js) for more examples.\n\n## Author\n\n**Jon Schlinkert**\n \n+ [github/jonschlinkert](https://github.com/jonschlinkert)\n+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) \n\n## License\nCopyright (c) 2014 Jon Schlinkert, contributors.  \nReleased under the MIT license\n\n***\n\n_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 26, 2014._","_attachments":{},"homepage":"https://github.com/jonschlinkert/path-segments","bugs":{"url":"https://github.com/jonschlinkert/path-segments/issues"}}