{"name":"common-sequence","author":{"name":"Lloyd Brookes","email":"75pound@gmail.com"},"version":"2.0.2","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":"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":"658a3d0557cc3f98aa7ac0e2309b697ccf387619","bugs":{"url":"https://github.com/75lb/common-sequence/issues"},"homepage":"https://github.com/75lb/common-sequence#readme","_id":"common-sequence@2.0.2","_nodeVersion":"15.11.0","_npmVersion":"7.6.0","dist":{"integrity":"sha512-jAg09gkdkrDO9EWTdXfv80WWH3yeZl5oT69fGfedBNS9pXUKYInVJ1bJ+/ht2+Moeei48TmSbQDYMc8EOx9G0g==","shasum":"accc76bdc5876a1fcd92b73484d4285fff99d838","tarball":"http://registry-npm.ywwl.com/common-sequence/download/common-sequence-2.0.2.tgz","fileCount":6,"unpackedSize":8447,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgTTnTCRA9TVsSAnZWagAAXQ0QAIZD5H+UkypgMa6rbobU\nCoqNrrocVl7mEWf66v6dyKisLi4QhlyJdReXS/7WlnxsCocKwSM8SOkPppge\nJbnSWg8UUi1sF244aZK66g1+nO6Ld2nqdh4SfscPJGgGCMUD9xFmfVCnS7Xa\nm3qehxiRYS+rNqjESuJdBwnW5Dv5hVcGRtOOnT94+LpjunY8olRc/66Try0h\nQ3VNW8Z2otR0J2lHW7Jn8vPUSr8DZ42rpFeE1xHptOR0G+SZXTxwIRsoR0l6\nYXLEALfHjooiizuxQj5wLVJXGVxrKvD7jjRhHs2iaueUC39Yc/4NAx8KPtxQ\nvc4k33bOzLeS7RCHgcrxZs7i0V4h3gITu85u4FwT84rsdLUKdYHW1QvD8M9x\nASUklXEjxKRkC8bJOHKECGlhPOKo5qtSfoOWE24AC2If8gH8uw1inXRgtZCo\ne+2XYVgbxtoVujrFpekBuDTIzIht9VIKneugn2MdyB5eV3P9a4I9l90l5eRT\nOJNz2QvKYASQJB1P8mi+KwjErQ8dN6dcVTwrDaQw1nM731eciKf6myzzJ8dD\nthkJGY5gN6r9OkADY1jFY/wgB6tDgEskGcfNyLk9DVVsxGHnADFoTacbxaCm\n9uKK0SBKOJFpsZA+Hmyfn5z8feWlyXKByVte9EM4FrZsJposKGGs1RFUF32o\nj3xe\r\n=pWA0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCTw0za3ONCZnJtaSp3YM3tJlPze9a6s8BPyMIEEJ3liAIgFLcWtkKUEdR9U2YrHH4JyTmYumNJi08oG2rioFe7h3w="}],"size":2652,"noattachment":false,"key":"/common-sequence/-/common-sequence-2.0.2.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.2_1615673811360_0.5091201632017037"},"_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":1615673811567,"_cnpm_publish_time":1615673811567,"dist-tags":{"latest":"3.0.0"}}