array-hyper-unique
Advanced tools
Comparing version 1.1.7 to 1.1.8
@@ -6,2 +6,15 @@ # Change Log | ||
## [1.1.8](https://github.com/bluelovers/ws-array/compare/array-hyper-unique@1.1.7...array-hyper-unique@1.1.8) (2020-06-20) | ||
### 📦 Code Refactoring | ||
* rename ([afe0647](https://github.com/bluelovers/ws-array/commit/afe0647f9899e2f5dc74bc099fb15e347e81460a)) | ||
* rename ([2e3b531](https://github.com/bluelovers/ws-array/commit/2e3b53175c85c5535c069da13b7811a4563a8d5f)) | ||
* rename ([cdf982b](https://github.com/bluelovers/ws-array/commit/cdf982b5c665d06ad9e467c1500d82e1c233c671)) | ||
## [1.1.7](https://github.com/bluelovers/ws-array/compare/array-hyper-unique@1.1.6...array-hyper-unique@1.1.7) (2020-06-18) | ||
@@ -8,0 +21,0 @@ |
@@ -1,43 +0,6 @@ | ||
import { IOptions } from './lib/types'; | ||
export * from './lib/types'; | ||
export * from './lib/util'; | ||
export declare function array_unique<T>(arr: T, options?: IOptions<T>): T; | ||
export declare function array_unique_overwrite<T>(arr: T, options?: IOptions<T>): T; | ||
export declare function lazy_unique<T extends any[]>(arr: T): T; | ||
export declare namespace lazy_unique { | ||
export var array_unique: typeof import("./core").array_unique; | ||
export var array_unique_overwrite: typeof import("./core").array_unique_overwrite; | ||
export var lazy_unique_overwrite: typeof import("./core").lazy_unique_overwrite; | ||
export var equals: typeof import("./lib/util").equals; | ||
export var defaultFilter: typeof import("./lib/util").defaultFilter; | ||
export var defaultChecker: typeof import("./lib/util").defaultChecker; | ||
export var lazy_unique: typeof import("./core").lazy_unique; | ||
var _a: typeof import("./core").lazy_unique; | ||
export { _a as default }; | ||
} | ||
export declare function lazy_unique<T, T1, T2>(a1: T1, a2: T2, ...arr: T[]): Array<T | T1 | T2>; | ||
export declare namespace lazy_unique { | ||
export var array_unique: typeof import("./core").array_unique; | ||
export var array_unique_overwrite: typeof import("./core").array_unique_overwrite; | ||
export var lazy_unique_overwrite: typeof import("./core").lazy_unique_overwrite; | ||
export var equals: typeof import("./lib/util").equals; | ||
export var defaultFilter: typeof import("./lib/util").defaultFilter; | ||
export var defaultChecker: typeof import("./lib/util").defaultChecker; | ||
export var lazy_unique: typeof import("./core").lazy_unique; | ||
var _a: typeof import("./core").lazy_unique; | ||
export { _a as default }; | ||
} | ||
export declare function lazy_unique<T>(...arr: Array<T | T[]>): T | (T | T[])[]; | ||
export declare namespace lazy_unique { | ||
export var array_unique: typeof import("./core").array_unique; | ||
export var array_unique_overwrite: typeof import("./core").array_unique_overwrite; | ||
export var lazy_unique_overwrite: typeof import("./core").lazy_unique_overwrite; | ||
export var equals: typeof import("./lib/util").equals; | ||
export var defaultFilter: typeof import("./lib/util").defaultFilter; | ||
export var defaultChecker: typeof import("./lib/util").defaultChecker; | ||
export var lazy_unique: typeof import("./core").lazy_unique; | ||
var _a: typeof import("./core").lazy_unique; | ||
export { _a as default }; | ||
} | ||
export declare function lazy_unique_overwrite<T>(...arr: Array<T | T[]>): T | (T | T[])[]; | ||
/** | ||
* Created by user on 2020/6/20. | ||
*/ | ||
export * from './index'; | ||
import lazy_unique from './index'; | ||
export default lazy_unique; |
64
core.js
"use strict"; | ||
/** | ||
* Created by user on 2020/6/20. | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
@@ -12,58 +15,9 @@ if (k2 === undefined) k2 = k; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.lazy_unique_overwrite = exports.lazy_unique = exports.array_unique_overwrite = exports.array_unique = void 0; | ||
const util_1 = require("./lib/util"); | ||
__exportStar(require("./lib/types"), exports); | ||
__exportStar(require("./lib/util"), exports); | ||
function array_unique(arr, options = {}) { | ||
if (!Array.isArray(arr)) { | ||
throw new TypeError(`Expected an Array but got ${typeof arr}.`); | ||
} | ||
const cb = util_1.defaultFilter(options); | ||
if (options.overwrite) { | ||
let index = arr.length; | ||
while (index--) { | ||
let val = arr[index]; | ||
if (!cb(val, index, arr)) { | ||
arr.splice(index, 1); | ||
} | ||
} | ||
return arr; | ||
} | ||
// @ts-ignore | ||
return arr.filter(cb); | ||
} | ||
exports.array_unique = array_unique; | ||
function array_unique_overwrite(arr, options = {}) { | ||
return array_unique(arr, { | ||
...options, | ||
overwrite: true, | ||
}); | ||
} | ||
exports.array_unique_overwrite = array_unique_overwrite; | ||
// @ts-ignore | ||
function lazy_unique(...arr) { | ||
if (arr.length > 1) { | ||
return array_unique(arr); | ||
} | ||
return array_unique(arr[0]); | ||
} | ||
exports.lazy_unique = lazy_unique; | ||
function lazy_unique_overwrite(...arr) { | ||
if (arr.length > 1) { | ||
return array_unique_overwrite(arr); | ||
} | ||
return array_unique_overwrite(arr[0]); | ||
} | ||
exports.lazy_unique_overwrite = lazy_unique_overwrite; | ||
lazy_unique.array_unique = array_unique; | ||
lazy_unique.array_unique_overwrite = array_unique_overwrite; | ||
lazy_unique.lazy_unique_overwrite = lazy_unique_overwrite; | ||
lazy_unique.equals = util_1.equals; | ||
lazy_unique.defaultFilter = util_1.defaultFilter; | ||
lazy_unique.defaultChecker = util_1.defaultChecker; | ||
lazy_unique.lazy_unique = lazy_unique; | ||
lazy_unique.default = lazy_unique; | ||
Object.defineProperty(lazy_unique, "__esModule", { value: true }); | ||
exports.default = lazy_unique; | ||
__exportStar(require("./index"), exports); | ||
const index_1 = __importDefault(require("./index")); | ||
exports.default = index_1.default; | ||
//# sourceMappingURL=core.js.map |
@@ -1,5 +0,43 @@ | ||
/** | ||
* Created by user on 2018/5/30/030. | ||
*/ | ||
import { lazy_unique } from './core'; | ||
export = lazy_unique; | ||
import { IOptions } from './lib/types'; | ||
export * from './lib/types'; | ||
export * from './lib/util'; | ||
export declare function array_unique<T>(arr: T, options?: IOptions<T>): T; | ||
export declare function array_unique_overwrite<T>(arr: T, options?: IOptions<T>): T; | ||
export declare function lazy_unique<T extends any[]>(arr: T): T; | ||
export declare namespace lazy_unique { | ||
export var array_unique: typeof import(".").array_unique; | ||
export var array_unique_overwrite: typeof import(".").array_unique_overwrite; | ||
export var lazy_unique_overwrite: typeof import(".").lazy_unique_overwrite; | ||
export var equals: typeof import("./lib/util").equals; | ||
export var defaultFilter: typeof import("./lib/util").defaultFilter; | ||
export var defaultChecker: typeof import("./lib/util").defaultChecker; | ||
export var lazy_unique: typeof import(".").lazy_unique; | ||
var _a: typeof import(".").lazy_unique; | ||
export { _a as default }; | ||
} | ||
export declare function lazy_unique<T, T1, T2>(a1: T1, a2: T2, ...arr: T[]): Array<T | T1 | T2>; | ||
export declare namespace lazy_unique { | ||
export var array_unique: typeof import(".").array_unique; | ||
export var array_unique_overwrite: typeof import(".").array_unique_overwrite; | ||
export var lazy_unique_overwrite: typeof import(".").lazy_unique_overwrite; | ||
export var equals: typeof import("./lib/util").equals; | ||
export var defaultFilter: typeof import("./lib/util").defaultFilter; | ||
export var defaultChecker: typeof import("./lib/util").defaultChecker; | ||
export var lazy_unique: typeof import(".").lazy_unique; | ||
var _a: typeof import(".").lazy_unique; | ||
export { _a as default }; | ||
} | ||
export declare function lazy_unique<T>(...arr: Array<T | T[]>): T | (T | T[])[]; | ||
export declare namespace lazy_unique { | ||
export var array_unique: typeof import(".").array_unique; | ||
export var array_unique_overwrite: typeof import(".").array_unique_overwrite; | ||
export var lazy_unique_overwrite: typeof import(".").lazy_unique_overwrite; | ||
export var equals: typeof import("./lib/util").equals; | ||
export var defaultFilter: typeof import("./lib/util").defaultFilter; | ||
export var defaultChecker: typeof import("./lib/util").defaultChecker; | ||
export var lazy_unique: typeof import(".").lazy_unique; | ||
var _a: typeof import(".").lazy_unique; | ||
export { _a as default }; | ||
} | ||
export declare function lazy_unique_overwrite<T>(...arr: Array<T | T[]>): T | (T | T[])[]; | ||
export default lazy_unique; |
71
index.js
"use strict"; | ||
/** | ||
* Created by user on 2018/5/30/030. | ||
*/ | ||
const core_1 = require("./core"); | ||
module.exports = core_1.lazy_unique; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.lazy_unique_overwrite = exports.lazy_unique = exports.array_unique_overwrite = exports.array_unique = void 0; | ||
const util_1 = require("./lib/util"); | ||
__exportStar(require("./lib/types"), exports); | ||
__exportStar(require("./lib/util"), exports); | ||
function array_unique(arr, options = {}) { | ||
if (!Array.isArray(arr)) { | ||
throw new TypeError(`Expected an Array but got ${typeof arr}.`); | ||
} | ||
const cb = util_1.defaultFilter(options); | ||
if (options.overwrite) { | ||
let index = arr.length; | ||
while (index--) { | ||
let val = arr[index]; | ||
if (!cb(val, index, arr)) { | ||
arr.splice(index, 1); | ||
} | ||
} | ||
return arr; | ||
} | ||
// @ts-ignore | ||
return arr.filter(cb); | ||
} | ||
exports.array_unique = array_unique; | ||
function array_unique_overwrite(arr, options = {}) { | ||
return array_unique(arr, { | ||
...options, | ||
overwrite: true, | ||
}); | ||
} | ||
exports.array_unique_overwrite = array_unique_overwrite; | ||
// @ts-ignore | ||
function lazy_unique(...arr) { | ||
if (arr.length > 1) { | ||
return array_unique(arr); | ||
} | ||
return array_unique(arr[0]); | ||
} | ||
exports.lazy_unique = lazy_unique; | ||
function lazy_unique_overwrite(...arr) { | ||
if (arr.length > 1) { | ||
return array_unique_overwrite(arr); | ||
} | ||
return array_unique_overwrite(arr[0]); | ||
} | ||
exports.lazy_unique_overwrite = lazy_unique_overwrite; | ||
lazy_unique.array_unique = array_unique; | ||
lazy_unique.array_unique_overwrite = array_unique_overwrite; | ||
lazy_unique.lazy_unique_overwrite = lazy_unique_overwrite; | ||
lazy_unique.equals = util_1.equals; | ||
lazy_unique.defaultFilter = util_1.defaultFilter; | ||
lazy_unique.defaultChecker = util_1.defaultChecker; | ||
lazy_unique.lazy_unique = lazy_unique; | ||
lazy_unique.default = lazy_unique; | ||
Object.defineProperty(lazy_unique, "__esModule", { value: true }); | ||
exports.default = lazy_unique; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "array-hyper-unique", | ||
"version": "1.1.7", | ||
"version": "1.1.8", | ||
"description": "Get unique values of an array. Really, like deeply unique.", | ||
@@ -73,3 +73,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "d7b3dcac924faac8f277385cf1353695ca05408d" | ||
"gitHead": "59af7c58177df810fc7535813116985638cccca1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30792
19
197
1