{"_id":"combine-lists","_rev":"347678","name":"combine-lists","description":"Merge two lists, trying to preserve the order of both ","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"sjelin","email":"sjelin@gmail.com"}],"time":{"modified":"2021-07-07T06:31:12.000Z","created":"2016-02-19T22:56:13.275Z","1.0.1":"2016-09-07T14:18:12.607Z","1.0.0":"2016-02-19T22:56:13.275Z"},"users":{"heineiuo":true},"author":{"name":"sjelin"},"repository":{"type":"git","url":"git+https://github.com/sjelin/combine-lists.git"},"versions":{"1.0.1":{"name":"combine-lists","version":"1.0.1","description":"Merge two lists, trying to preserve the order of both ","main":"index.js","scripts":{"test":"node node_modules/.bin/jasmine JASMINE_CONFIG_PATH=test/config.json"},"repository":{"type":"git","url":"git+https://github.com/sjelin/combine-lists.git"},"keywords":["utility","array","list","merge","combine","topological","sort"],"author":{"name":"sjelin"},"license":"MIT","bugs":{"url":"https://github.com/sjelin/combine-lists/issues"},"homepage":"https://github.com/sjelin/combine-lists#readme","dependencies":{"lodash":"^4.5.0"},"devDependencies":{"jasmine":"^2.4.1","seedrandom":"^2.4.2"},"gitHead":"ae52afa4b79bc4802a14af8914745ac0e3a77d51","_id":"combine-lists@1.0.1","_shasum":"458c07e09e0d900fc28b70a3fec2dacd1d2cb7f6","_from":".","_npmVersion":"3.7.2","_nodeVersion":"4.0.0","_npmUser":{"name":"sjelin","email":"sjelin@gmail.com"},"dist":{"shasum":"458c07e09e0d900fc28b70a3fec2dacd1d2cb7f6","size":3062,"noattachment":false,"key":"/combine-lists/-/combine-lists-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/combine-lists/download/combine-lists-1.0.1.tgz"},"maintainers":[{"name":"sjelin","email":"sjelin@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/combine-lists-1.0.1.tgz_1473257890976_0.5467275755945593"},"directories":{},"publish_time":1473257892607,"_cnpm_publish_time":1473257892607,"_hasShrinkwrap":false},"1.0.0":{"name":"combine-lists","version":"1.0.0","description":"Merge two lists, trying to preserve the order of both ","main":"index.js","scripts":{"test":"node node_modules/.bin/jasmine JASMINE_CONFIG_PATH=test/config.json"},"repository":{"type":"git","url":"git+https://github.com/sjelin/combine-lists.git"},"keywords":["utility","array","list","merge","combine","topological","sort"],"author":{"name":"sjelin"},"license":"MIT","bugs":{"url":"https://github.com/sjelin/combine-lists/issues"},"homepage":"https://github.com/sjelin/combine-lists#readme","dependencies":{"lodash":"^4.5.0"},"devDependencies":{"jasmine":"^2.4.1","seedrandom":"^2.4.2"},"gitHead":"8ae9086d9f648ebb54911ede08e750b55f8a4d0a","_id":"combine-lists@1.0.0","_shasum":"e55dee53e5584f232eb59aeb16a7e66c338b5d06","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"sjelin","email":"sjelin@gmail.com"},"maintainers":[{"name":"sjelin","email":"sjelin@gmail.com"}],"dist":{"shasum":"e55dee53e5584f232eb59aeb16a7e66c338b5d06","size":2366,"noattachment":false,"key":"/combine-lists/-/combine-lists-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/combine-lists/download/combine-lists-1.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/combine-lists-1.0.0.tgz_1455922568744_0.7149797205347568"},"directories":{},"publish_time":1455922573275,"_cnpm_publish_time":1455922573275,"_hasShrinkwrap":false}},"readme":"This tool merges two lists, removing duplicates, and doing everything possible\nto maintain the order of the two lists.\n\nThis tool guarantees that the order of the first list is preserved (that is, if\nx comes before y in the first list, x comes before y in the returned list) and\ntries not to undo the order of the second list, though sometimes it is\nunavoidable.\n\nFor example, if we have `list1 = [1, 2, 4]` and `list2 = [2, 1, 3, 4]`, then the\nmerged list would be `[1, 2, 3, 4]`, since that preserves the order of `list1`\nwhile doing the best job possible of preserving the order of `list2`.\n\nA case like `list1 = [1, 3]`, `list2 = [3, 2, 1]` is more complicated.  It's not\nclear what the best merged list is, but it's probably either `[2, 1, 3]` or\n`[1, 3, 2]`.\n\nIn general, it's not totally clear what the \"best\" merged list is, but there are\nsome basic properties that anyone would expect:\n\n- Since the order of list1 is preserved, the merged list will look like the\n  first list with the elements exclusive to the second inserted in betweeen\n- If `list2[i]` is not in `list1`, and it is possible to insert `list2[i]` into\n  `list1` without contradicting the order of `list2`, then it should be inserted\n  in such a way\n\nThis tool is very slow, crossing the 100ms mark with lists around 150 in length,\nand growing at a rate of\n`O(list2.length*list2.length*(list1.length + list2.length))` from there.\n\n\nInstallation / Usage\n--------------------\n\nInstall with\n\n```\nnpm install combine-lists\n```\n\nUse like so:\n\n```js\nvar combineLists = require('combine-lists');\ncombineLists([1, 2], [2, 3]); // [1, 2, 3]\n```\n","_attachments":{},"homepage":"https://github.com/sjelin/combine-lists#readme","bugs":{"url":"https://github.com/sjelin/combine-lists/issues"},"license":"MIT"}