{"name":"common-sequence","author":{"name":"Lloyd Brookes","email":"75pound@gmail.com"},"version":"1.0.1","description":"common-sequence","repository":{"type":"git","url":"git+https://github.com/75lb/common-sequence.git"},"license":"MIT","main":"./lib/common-sequence.js","keywords":["common","path","folder","dir","compare","parent","array","sequence"],"engines":{"node":">=0.10.0"},"scripts":{"test":"tape test/*.js","lint":"jshint lib/*.js bin/*.js test/*.js; echo","docs":"jsdoc2md -t jsdoc2md/README.hbs lib/*.js > README.md; echo"},"devDependencies":{"jsdoc-to-markdown":"^1.1.1","tape":"^4.0.0"},"gitHead":"7a20e064663bc02aff788000f81eb60414172bce","bugs":{"url":"https://github.com/75lb/common-sequence/issues"},"homepage":"https://github.com/75lb/common-sequence#readme","_id":"common-sequence@1.0.1","_shasum":"2ea04175c819a8084699638f75bbd4de8a396fec","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"75lb","email":"75pound@gmail.com"},"dist":{"shasum":"2ea04175c819a8084699638f75bbd4de8a396fec","tarball":"http://registry-npm.ywwl.com/common-sequence/download/common-sequence-1.0.1.tgz","integrity":"sha512-pRGkQmbbcu00CoJxR54u+YblFXcF3Bb6BBRfw5I31FAT3J+wA5ZIa97ieBgBngJ01rAsTjET6M3nWJbPV/fo2g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCPxLQjLr2DbDdXtHfwHgm67a/tmcH7ZrW2Wn4xDatFkwIgI7JAictVWlRXN3Lz7L8Dhh/N8DDvzIZxShx0eTu7qms="}],"size":2488,"noattachment":false,"key":"/common-sequence/-/common-sequence-1.0.1.tgz"},"maintainers":[{"name":"75lb","email":"75pound@gmail.com"}],"directories":{},"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":1435002342244,"_cnpm_publish_time":1435002342244,"dist-tags":{"latest":"3.0.0"}}