{"name":"split-string","description":"Easy way to split a string on a given character unless it's quoted or escaped.","version":"6.1.0","homepage":"https://github.com/jonschlinkert/split-string","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"contributors":[{"name":"Brian Woodward","url":"https://twitter.com/doowb"},{"name":"Jon Schlinkert","url":"http://twitter.com/jonschlinkert"}],"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/split-string.git"},"bugs":{"url":"https://github.com/jonschlinkert/split-string/issues"},"license":"MIT","main":"index.js","types":"types/index.d.ts","engines":{"node":">=8.6"},"scripts":{"test":"nyc mocha","test:types":"dtslint types"},"devDependencies":{"dtslint":"^0.7.0","gulp-format-md":"^1.0.0","mocha":"^5.2.0","nyc":"^12.0.2"},"keywords":["character","escape","split","string"],"nyc":{"reporter":["lcov","text-summary"]},"verb":{"toc":false,"layout":"default","titles":[".","install","Why use this?"],"related":{"list":["deromanize","randomatic","repeat-string","romanize"]},"tasks":["readme"],"plugins":["gulp-format-md"],"lint":{"reflinks":true}},"gitHead":"757bdcb3bd110e8dfb55ae35d2856b6875692aad","_id":"split-string@6.1.0","_nodeVersion":"10.15.2","_npmVersion":"6.9.0","_npmUser":{"name":"doowb","email":"brian.woodward@gmail.com"},"dist":{"integrity":"sha512-9UBdnmnvx2NLLd4bMs7CEKK+wSzbujVv3ONyorkP1o8M3pVJQtXDO1cN19xD1JJs6ltOrtPrkUND0HzLSinUcA==","shasum":"e9cedcf94cdab077d9b5528927894dec4b0f42ab","tarball":"http://registry-npm.ywwl.com/split-string/download/split-string-6.1.0.tgz","fileCount":6,"unpackedSize":19425,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcvkhNCRA9TVsSAnZWagAAwB0P/24jbZb3hUGwREdoNr0S\nBSpYZ+Z6TzTa4cyToDphy2i+38GfVeY7xQrno60egFvvsEvIIWKlMbsYZxGK\nKZeSDPioSJDXiMJQWqhokg96qxWY51ToxjMapRUuEnXU+Nh1rTVVocLoAK1C\nsvu2ARcU6A/af9Gma0E6EHsmipzLXaei8kQBqfGegQajpGK34W61W9chFOkm\nwMcB8YAbsoOSo1vEiR4oxwuulUOflv0S70q5aIBZxqwJYfwgqAiciF2gJD1V\nAHwcP5H9Iw1ZZrprpM5jtGYavlYecjxafFY8+QGJJUeqIqxDYm1Dg5s4V9Ng\nIeAMXS3UaIsS/l1Xvt9UwhuRw4D3sPhW+jolZTWliKTLMnjk4P248RYoTr0s\n14NtID3YFVOdZShl34reflyhkZWkh8Ey9SYBWi7HNFFbB7342xnEZQb0zrwC\nByJNRDdte01PqzS5teafcLgUbFJZMIHPfesy37zj39WFf4y3GI7LuHXZBWUx\nVePbLd9OVOy6HVQ0/Wu4416tuQmcPIPphjxjxvuJWZMbw+DvkwfaEgx6vm4o\nahtPk7039fm9hMkMRpmJZ8Yu1jh/hpSgXJzjQX2hnHQskc4Kzu8G6jHFx6fG\nO4Q4+dpRswADNKMKrBZSSfuI7uHdwQ0SZA6JvWiJ78TJPygYlaIPyPA8LQcF\nfppd\r\n=H3Ma\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDB3GbBBsEPh2mmjHn2FeloE91KjbLdvt9JufIgLp+hpAIgBrRaDsn0CsL/B9bajdBmKqHYhLKqrQ+DrDVhcW79V/o="}],"size":6773,"noattachment":false,"key":"/split-string/-/split-string-6.1.0.tgz"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/split-string_6.1.0_1555974220946_0.4783880589392515"},"_hasShrinkwrap":false,"readme":"# split-string [![NPM version](https://img.shields.io/npm/v/split-string.svg?style=flat)](https://www.npmjs.com/package/split-string) [![NPM monthly downloads](https://img.shields.io/npm/dm/split-string.svg?style=flat)](https://npmjs.org/package/split-string) [![NPM total downloads](https://img.shields.io/npm/dt/split-string.svg?style=flat)](https://npmjs.org/package/split-string) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/split-string.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/split-string)\n\n> Easy way to split a string on a given character unless it's quoted or escaped.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save split-string\n```\n\n## Usage\n\n```js\nconst split = require('split-string');\n\nconsole.log(split('a.b.c'));\n//=> ['a', 'b', 'c']\n\n// respects escaped characters\nconsole.log(split('a.b.c\\\\.d'));\n//=> ['a', 'b', 'c.d']\n\n// respects double-quoted strings\nconsole.log(split('a.\"b.c.d\".e'));\n//=> ['a', '\"b.c.d\"', 'e']\n```\n\n## Options\n\n### options.quotes\n\n**Type**: `Array|Boolean`\n\n**Default**: `[]`\n\n**Description**\n\nTell split-string not to split inside any of the quote characters specified on the quotes option. Each character signifies both the \"opening\" and \"closing\" character to use.\n\n```js\n// default behavior\nconsole.log(split('a.b.\"c.d.e.f.g\".h.i'));\n//=> [ 'a', 'b', '\"c', 'd', 'e', 'f', 'g\"', 'h', 'i' ]\n\n// with quotes\nconsole.log(split('a.b.\"c.d.e.f.g\".h.i', { quotes: ['\"'] }));\n//=> [ 'a', 'b', '\"c.d.e.f.g\"', 'h', 'i' ]\n\n// escaped quotes will be ignored\nconsole.log(split('a.b.\\\\\"c.d.\"e.f.g\".h.i', { quotes: ['\"'] }));\n//=> [ 'a', 'b', '\"c', 'd', '\"e.f.g\"', 'h', 'i' ]\n\n// example of how to exclude non-escaped quotes from the result\nlet keep = (value, state) => {\n  return value !== '\\\\' && (value !== '\"' || state.prev() === '\\\\');\n};\nconsole.log(split('a.b.\\\\\"c.d.\"e.f.g\".h.i', { quotes: ['\"'], keep }));\n//=> [ 'a', 'b', '\"c', 'd', 'e.f.g', 'h', 'i' ]\n```\n\n## Options\n\n### options.brackets\n\n**Type**: `Object|Boolean`\n\n**Default**: `{}`\n\n**Description**\n\nBy default, no special significance is given to bracket-like characters (such as square brackets, curly braces, angle brackets, and so on).\n\n```js\n// default behavior\nconsole.log(split('a.{b.c}.{d.e}'));\n//=> [ 'a', '{b', 'c}', '{d', 'e}' ]\n```\n\nWhen `options.brackets` is `true`, the following brackets types are supported:\n\n```js\n{\n  '<': '>',\n  '(': ')',\n  '[': ']',\n  '{': '}'\n}\n```\n\nFor example:\n\n```js\nconsole.log(split('a.{b.c}.{d.e}', { brackets: true }));\n//=> [ 'a', '{b.c}', '{d.e}' ]\n```\n\nAlternatively, an object of brackets may be passed, where each key is the _opening bracket_ and each value is the corresponding _closing bracket_. Note that the key and value **must be different characters**. If you want to use the same character for both open and close, use the [quotes option](#optionsquotes).\n\n**Examples**\n\n```js\n// no bracket support by default\nconsole.log(split('a.{b.c}.[d.e].f'));\n//=> [ 'a', '{b', 'c}', '[d', 'e]', 'f' ]\n\n// tell split-string not to split inside curly braces\nconsole.log(split('a.{b.c}.[d.e].f', { brackets: { '{': '}' }}));\n//=> [ 'a', '{b.c}', '[d', 'e]', 'f' ]\n\n// tell split-string not to split inside any of these types: \"<>{}[]()\"\nconsole.log(split('a.{b.c}.[d.e].f', { brackets: true }));\n//=> [ 'a', '{b.c}', '[d.e]', 'f' ]\n\n// ...nested brackets are also supported\nconsole.log(split('a.{b.{c.d}.e}.f', { brackets: true }));\n//=> [ 'a', '{b.{c.d}.e}', 'f' ]\n\n// tell split-string not to split inside the given custom types\nconsole.log(split('«a.b».⟨c.d⟩.[e.f]', { brackets: { '«': '»', '⟨': '⟩' } }));\n//=> [ '«a.b»', '⟨c.d⟩', '[e', 'f]' ]\n```\n\n### options.keep\n\n**Type**: `function`\n\n**Default**: Function that returns true if the character is not `\\\\`.\n\nFunction that returns true when a character should be retained in the result.\n\n**Example**\n\n```js\nconsole.log(split('a.b\\\\.c')); //=> ['a', 'b.c']\n\n// keep all characters\nconsole.log(split('a.b.\\\\c', { keep: () => true })); //=> ['a', 'b\\.c']\n```\n\n### options.separator\n\n**Type**: `string`\n\n**Default**: `.`\n\nThe character to split on.\n\n**Example**\n\n```js\nconsole.log(split('a.b,c', { separator: ',' })); //=> ['a.b', 'c']\n```\n\n## Split function\n\nOptionally pass a function as the last argument to tell split-string whether or not to split when the specified separator is encountered.\n\n**Example**\n\n```js\n// only split on \".\" when the \"previous\" character is \"a\"\nconsole.log(split('a.b.c.a.d.e', state => state.prev() === 'a'));\n//=> [ 'a', 'b.c.a', 'd.e' ]\n```\n\nThe `state` object exposes the following properties:\n\n* `input` - (String) The un-modified, user-defined input string\n* `separator` - (String) the specified separator to split on.\n* `index` - (Number) The current cursor position\n* `value` - (String) The character at the current index\n* `bos` - (Function) Returns true if position is at the beginning-of-string\n* `eos` - (Function) Returns true if position is at the end-of-string\n* `prev` - (Function) Returns the previously scanned character\n* `next` - (Function) Returns the next character after the current position\n* `block` - (Object) The \"current\" AST node.\n* `stack` - (Array) AST nodes\n\n## About\n\n<details>\n<summary><strong>Contributing</strong></summary>\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n</details>\n\n<details>\n<summary><strong>Running Tests</strong></summary>\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install && npm test\n```\n\n</details>\n\n<details>\n<summary><strong>Building docs</strong></summary>\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n</details>\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [deromanize](https://www.npmjs.com/package/deromanize): Convert roman numerals to arabic numbers (useful for books, outlines, documentation, slide decks, etc) | [homepage](https://github.com/jonschlinkert/deromanize \"Convert roman numerals to arabic numbers (useful for books, outlines, documentation, slide decks, etc)\")\n* [randomatic](https://www.npmjs.com/package/randomatic): Generate randomized strings of a specified length using simple character sequences. The original generate-password. | [homepage](https://github.com/jonschlinkert/randomatic \"Generate randomized strings of a specified length using simple character sequences. The original generate-password.\")\n* [repeat-string](https://www.npmjs.com/package/repeat-string): Repeat the given string n times. Fastest implementation for repeating a string. | [homepage](https://github.com/jonschlinkert/repeat-string \"Repeat the given string n times. Fastest implementation for repeating a string.\")\n* [romanize](https://www.npmjs.com/package/romanize): Convert numbers to roman numerals (useful for books, outlines, documentation, slide decks, etc) | [homepage](https://github.com/jonschlinkert/romanize \"Convert numbers to roman numerals (useful for books, outlines, documentation, slide decks, etc)\")\n\n### Contributors\n\n| **Commits** | **Contributor** |  \n| --- | --- |  \n| 56 | [jonschlinkert](https://github.com/jonschlinkert) |  \n| 12 | [doowb](https://github.com/doowb) |  \n| 6  | [Ovyerus](https://github.com/Ovyerus) |  \n| 1  | [silverwind](https://github.com/silverwind) |  \n\n### Author\n\n**Jon Schlinkert**\n\n* [GitHub Profile](https://github.com/jonschlinkert)\n* [Twitter Profile](https://twitter.com/jonschlinkert)\n* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)\n\n### License\n\nCopyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 22, 2019._","publish_time":1555974221133,"_cnpm_publish_time":1555974221133,"dist-tags":{"latest":"6.1.0"}}