{"name":"common-sequence","author":{"name":"Lloyd Brookes","email":"75pound@gmail.com"},"version":"1.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":"./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":"bdfd45b1358fd8fc8f90c90dde9960cc9555fb01","bugs":{"url":"https://github.com/75lb/common-sequence/issues"},"homepage":"https://github.com/75lb/common-sequence#readme","_id":"common-sequence@1.0.2","_shasum":"30e07f3f8f6f7f9b3dee854f20b2d39eee086de8","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"75lb","email":"75pound@gmail.com"},"dist":{"shasum":"30e07f3f8f6f7f9b3dee854f20b2d39eee086de8","tarball":"http://registry-npm.ywwl.com/common-sequence/download/common-sequence-1.0.2.tgz","integrity":"sha512-z3ln8PqfoBRwY1X0B1W0NEvfuo3+lZdvVjYaxusK84FPGkBy+ZqfbMhgdGOLr1v1dv13z5KYOtbL/yupL4I8Yw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDTJpx2JRFAC4CJe6+tUmuojoCrfevLYotJVdLCAPHB8AiBODXpDv0sGuZwdBeLTVNTCmtfusqAhdgKqVVLMRd/amw=="}],"size":2490,"noattachment":false,"key":"/common-sequence/-/common-sequence-1.0.2.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":1435002487842,"_cnpm_publish_time":1435002487842,"dist-tags":{"latest":"3.0.0"}}