{"name":"common-sequence","author":{"name":"Lloyd Brookes","email":"75pound@gmail.com"},"version":"2.0.0","description":"Returns an array containing the initial elements which both input arrays have in common","repository":{"type":"git","url":"git+https://github.com/75lb/common-sequence.git"},"license":"MIT","main":"dist/index.js","module":"index.mjs","keywords":["common","path","folder","dir","compare","parent","array","sequence"],"engines":{"node":">=8"},"scripts":{"test":"npm run dist && test-runner test.js","docs":"jsdoc2md -c jsdoc.conf -t README.hbs index.mjs > README.md","dist":"rollup -f umd -n commonSequence -o dist/index.js index.mjs"},"devDependencies":{"jsdoc-to-markdown":"^5.0.1","rollup":"^1.21.4","test-runner":"^0.6.0"},"gitHead":"b55f198afcf6a09eb83de89407796b993bd6aa8b","bugs":{"url":"https://github.com/75lb/common-sequence/issues"},"homepage":"https://github.com/75lb/common-sequence#readme","_id":"common-sequence@2.0.0","_nodeVersion":"12.10.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-f0QqPLpRTgMQn/pQIynf+SdE73Lw5Q1jn4hjirHLgH/NJ71TiHjXusV16BmOyuK5rRQ1W2f++II+TFZbQOh4hA==","shasum":"a4f01aaf5aebd0ac1ce43653e8c8fe6f0ef3a987","tarball":"http://registry-npm.ywwl.com/common-sequence/download/common-sequence-2.0.0.tgz","fileCount":6,"unpackedSize":7747,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdj7Q0CRA9TVsSAnZWagAA+gYQAIOsrQGfIWgufvB3snaq\nF/CrobhWXP3oYLRQW02qj+IMm0PV1vv76oZ/s4iKInS2hgx00Bxu7Rr0RPgX\nKOlTwtX7qLxfExWjTxS9cJmuMobRjx5lQpvnpZyOm6B/BDuNTvuDTD0laIsg\nJmBfCGXaMlHnVxc1Fx83Cp79z5j3wg3c0Jgy9KXV3WJT6H0HwH2vGNhE8eo6\nX6KiPDdPXcNrqFzfCf9RIfdPDvoz3hwqBDwzE37VsuxrmkC9W3+Z4JZ5LiX/\nk+MKMirQ4LXKJMxgBHyAssywdVAfcKzltM8ZXkIbIz0T/2frw0GVgLcfLDTb\nUOsadWwrgLLssOH5SSBOLIcYjg52b5KL/u/LLx9u/BUZFDUz3B6OQxpSThf0\n519wLa7YtruCOEJBKHmliGx/d0Lnjwif37NCL9C+jU+niYeeWcZ+eEZf8ssd\nh2dZE4Z8AmfN1BrR+pfZh9y8fBPDqBpTJK1BHGYg4MFTZNoovE4jTh5FUfh/\nn2AgIFOjVg4XU6AvNqfonVt/C6x81i26FkJxZkqYn+xTWpzIdyYk43Ds/xr4\nejtA7FX69jU1YXqH9QmhhJNoOpiZEzrMBFDA6zdbMYtHrHqmuR4R4cR7KbDk\nvNED0E+CTGUo+Wn/oVibZVOEkgu18315KSEwqkyRfN2O01JBMB5Xfec/xVzl\nXVES\r\n=tGSX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGM4PNpOPi9OizXl2iWF/bCbcKnDXQ8Qfou5p+xyjGl0AiAbdps5L9toaIi+E2wlsUg5SA++u5zmjqgvlU9a2XQKfQ=="}],"size":2578,"noattachment":false,"key":"/common-sequence/-/common-sequence-2.0.0.tgz"},"maintainers":[{"name":"75lb","email":"75pound@gmail.com"}],"_npmUser":{"name":"75lb","email":"75pound@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/common-sequence_2.0.0_1569698867946_0.38371915046787564"},"_hasShrinkwrap":false,"readme":"[![view on npm](https://badgen.net/npm/v/common-sequence)](https://www.npmjs.org/package/common-sequence)\n[![npm module downloads](https://badgen.net/npm/dt/common-sequence)](https://www.npmjs.org/package/common-sequence)\n[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/common-sequence)](https://github.com/75lb/common-sequence/network/dependents?dependent_type=REPOSITORY)\n[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/common-sequence)](https://github.com/75lb/common-sequence/network/dependents?dependent_type=PACKAGE)\n[![Build Status](https://travis-ci.org/75lb/common-sequence.svg?branch=master)](https://travis-ci.org/75lb/common-sequence)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)\n\n<a name=\"module_common-sequence\"></a>\n\n## common-sequence\nReturns an array containing the initial elements which both input arrays have in common.\n\nA common use-case for this is discovering common ancestors between two file paths.\n\n```js\n> commonSequence = require('common-sequence');\n\n> pathA = '/Users/lloyd/Documents/75lb/dmd'.split('/');\n> pathB = '/Users/lloyd/Documents/75lb/array-tools'.split('/');\n\n> commonSequence(pathA, pathB).join('/');\n'/Users/lloyd/Documents/75lb'\n```\n\nor a more trivial example:\n```js\n> a.commonSequence([ 1, 2, 3 ], [ 1, 2, 4 ])\n[ 1, 2 ]\n```\n\n<a name=\"exp_module_common-sequence--commonSequence\"></a>\n\n### commonSequence(a, b) ⇒ <code>Array</code> ⏏\nReturns the initial elements which both input arrays have in common\n\n**Kind**: Exported function  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| a | <code>Array</code> | first array to compare |\n| b | <code>Array</code> | second array to compare |\n\n\n### Load anywhere\n\nThis library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.\n\nNode.js:\n\n```js\nconst commonSequence = require('common-sequence')\n```\n\nWithin Node.js with ECMAScript Module support enabled:\n\n```js\nimport commonSequence from 'common-sequence'\n```\n\nWithin an modern browser ECMAScript Module:\n\n```js\nimport commonSequence from './node_modules/common-sequence/index.mjs'\n```\n\nOld browser (adds `window.commonSequence`):\n\n```html\n<script nomodule src=\"./node_modules/common-sequence/dist/index.js\"></script>\n```\n\n* * *\n\n&copy; 2015-21 Lloyd Brookes \\<75pound@gmail.com\\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).\n","publish_time":1569698868076,"_cnpm_publish_time":1569698868076,"dist-tags":{"latest":"3.0.0"}}