{"name":"common-sequence","author":{"name":"Lloyd Brookes","email":"75pound@gmail.com"},"version":"2.0.1","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":"^7.0.0","rollup":"^2.41.2","test-runner":"^0.6.3"},"gitHead":"983fd63df17fbcea5a499b6f0b4a02280065c649","bugs":{"url":"https://github.com/75lb/common-sequence/issues"},"homepage":"https://github.com/75lb/common-sequence#readme","_id":"common-sequence@2.0.1","_nodeVersion":"15.11.0","_npmVersion":"7.6.0","dist":{"integrity":"sha512-Mploxq1cmWFoV6vVlkMApQqPKZrYdxp6sync1Bb3PHSlSSCX5kqrV9V3P1ymLL2KsYc//OeJ1fF701aBUS72rg==","shasum":"5f2235f98895af75a9a4e2542271ac6037666573","tarball":"http://registry-npm.ywwl.com/common-sequence/download/common-sequence-2.0.1.tgz","fileCount":6,"unpackedSize":8463,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgTTlhCRA9TVsSAnZWagAAp60P/0I95TYMM6I1ZULL9TG2\nbB/m3pUBqIYpXBbWw4bMahOMjupVXa2zY/8aD6ihBlPWJbpdRH3NLFPgkEaU\ni3eNxQubhYjnz2Uye9xd04HuDe1Jbmy8C8bhkekLsGRsRNl/cAy6qofnx5oz\nPt3Zu6LLfPKpMvRpsbG88h0zaL1GC7KyEfF59L81ieKlHxqoClk5VeThhc/x\n/E8fsSg7QD+k9UsGDV1YF3oEYKNpmGZ3qNu2SYub1IDb+FPwJ+6n5iAk8TNK\nMmAl8gOHmsEGefedzGYxNAos3XRBOeiiL+a97Iu2L8ppCFJ/hFGoOcMzYFYV\nvtKt0lVmqih8abUBfJ3Ixb65TIEaHpEW431dPOYcuDPycO1rMLGbQKuNs1Ek\n+wSVFSpb4af+BC4JpnT0EUhf49sm/JpZyJt/NAEotgUiscN0j4t/xtjgenC6\nT2gvj5zPvCREqyWdrbNQv+53Ehw0kdsfUldbpw/7cKX/n43jH1H28nsSn+G0\nc1BLhQWO10xsXuGricF1sfpi7ir0v2Bax3FGVTYoFAvH+Bn204uF7WCGtcsW\n+MYqxL+oFY9gan4izTvqyW3MAS0bZ0ZCp+xdh0Rz1fbCpcSYzBu47jW+jDTR\nYLiGIWcwdlfYlhJdOI+b5UNzEWBfrol+HPFmQHL+MVSclJ3RhKtGppE6njJF\nVnt/\r\n=OnTk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDPixvpWuJhm9K1eM1G3r7afHunzgFhcH6cmB/gm//rbAIgIuCrqtZ4x9i1IjSPXDuT2zEFGcmxeEOA6hH3OXSeJYU="}],"size":2661,"noattachment":false,"key":"/common-sequence/-/common-sequence-2.0.1.tgz"},"_npmUser":{"name":"75lb","email":"75pound@gmail.com"},"directories":{},"maintainers":[{"name":"75lb","email":"75pound@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/common-sequence_2.0.1_1615673696670_0.6289296568600631"},"_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":1615673696810,"_cnpm_publish_time":1615673696810,"dist-tags":{"latest":"3.0.0"}}