diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:10:59 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:41:44 +0800 |
| commit | fc87c009806dcc98867f6b58efe29b042aa01dee (patch) | |
| tree | 8f59b3f4a5b66e9dfef2d40c8d318e258a521228 /node_modules/uniq | |
| parent | 3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff) | |
node: updatemain
Diffstat (limited to 'node_modules/uniq')
| -rw-r--r-- | node_modules/uniq/.npmignore | 15 | ||||
| -rw-r--r-- | node_modules/uniq/LICENSE | 22 | ||||
| -rw-r--r-- | node_modules/uniq/README.md | 46 | ||||
| -rw-r--r-- | node_modules/uniq/package.json | 36 | ||||
| -rw-r--r-- | node_modules/uniq/test/test.js | 11 | ||||
| -rw-r--r-- | node_modules/uniq/uniq.js | 57 |
6 files changed, 0 insertions, 187 deletions
diff --git a/node_modules/uniq/.npmignore b/node_modules/uniq/.npmignore deleted file mode 100644 index 0d1b0b09..00000000 --- a/node_modules/uniq/.npmignore +++ /dev/null @@ -1,15 +0,0 @@ -lib-cov -*.seed -*.log -*.csv -*.dat -*.out -*.pid -*.gz - -pids -logs -results - -npm-debug.log -node_modules/*
\ No newline at end of file diff --git a/node_modules/uniq/LICENSE b/node_modules/uniq/LICENSE deleted file mode 100644 index 8ce206a8..00000000 --- a/node_modules/uniq/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ - -The MIT License (MIT) - -Copyright (c) 2013 Mikola Lysenko - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/uniq/README.md b/node_modules/uniq/README.md deleted file mode 100644 index 9e0abafe..00000000 --- a/node_modules/uniq/README.md +++ /dev/null @@ -1,46 +0,0 @@ -uniq -==== -Removes all duplicates from an array in place. - -Usage -===== -First install using npm: - - npm install uniq - -Then use it as follows: - -```javascript - -var arr = [1, 1, 2, 2, 3, 5] - -require("uniq")(arr) -console.log(arr) - -//Prints: -// -// 1,2,3,5 -// -``` - -## `require("uniq")(array[, compare, sorted])` -Removes all duplicates from a sorted array in place. - -* `array` is the array to remove items from -* `compare` is an optional comparison function that returns 0 when two items are equal, and something non-zero when they are different. If unspecified, then the default equals will be used. -* `sorted` if true, then assume array is already sorted - -**Returns:** A reference to `array` - -**Time Complexity:** `O(array.length * log(arra.length))` or `O(array.length)` if `sorted` - - -## Why use this instead of underscore.uniq[ue]? -A few reasons: - -* This library updates the array in place without making an extra copy (and so it is faster for large arrays) -* It also accepts a custom comparison function so you can remove duplicates from arrays containing object -* It is more modular in the sense that it doesn't come with a bazillion other utility grab bag functions. - -# Credits -(c) 2013 Mikola Lysenko. MIT License diff --git a/node_modules/uniq/package.json b/node_modules/uniq/package.json deleted file mode 100644 index 9c91dda0..00000000 --- a/node_modules/uniq/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "uniq", - "version": "1.0.1", - "description": "Removes duplicates from a sorted array in place", - "main": "uniq.js", - "directories": { - "test": "test" - }, - "dependencies": {}, - "devDependencies": { - "tape": "^2.12.3" - }, - "scripts": { - "test": "tape test/*.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/mikolalysenko/uniq.git" - }, - "keywords": [ - "array", - "duplicate", - "unique", - "uniq", - "remove", - "sort", - "in", - "place", - "no", - "copy" - ], - "author": "Mikola Lysenko", - "license": "MIT", - "readmeFilename": "README.md", - "gitHead": "e9828cfcb97e25a351f95b39fdf3c31876ff3985" -} diff --git a/node_modules/uniq/test/test.js b/node_modules/uniq/test/test.js deleted file mode 100644 index efc4fc8b..00000000 --- a/node_modules/uniq/test/test.js +++ /dev/null @@ -1,11 +0,0 @@ -var unique = require("../uniq.js") - -require("tape")("unique", function(t) { - - t.equals(unique([1,1,2,3,5,5,7]).join(), [1,2,3,5,7].join()) - t.equals(unique([]).join(), [].join()) - t.equals(unique([1,1,1]).join(), [1].join()) - t.equals(unique([1,1,1,2,2,2], function(a,b) { return (a^b)&1 }).join(), [2,1].join()) - - t.end() -})
\ No newline at end of file diff --git a/node_modules/uniq/uniq.js b/node_modules/uniq/uniq.js deleted file mode 100644 index e86c44b5..00000000 --- a/node_modules/uniq/uniq.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict" - -function unique_pred(list, compare) { - var ptr = 1 - , len = list.length - , a=list[0], b=list[0] - for(var i=1; i<len; ++i) { - b = a - a = list[i] - if(compare(a, b)) { - if(i === ptr) { - ptr++ - continue - } - list[ptr++] = a - } - } - list.length = ptr - return list -} - -function unique_eq(list) { - var ptr = 1 - , len = list.length - , a=list[0], b = list[0] - for(var i=1; i<len; ++i, b=a) { - b = a - a = list[i] - if(a !== b) { - if(i === ptr) { - ptr++ - continue - } - list[ptr++] = a - } - } - list.length = ptr - return list -} - -function unique(list, compare, sorted) { - if(list.length === 0) { - return list - } - if(compare) { - if(!sorted) { - list.sort(compare) - } - return unique_pred(list, compare) - } - if(!sorted) { - list.sort() - } - return unique_eq(list) -} - -module.exports = unique |
