@febin52/unique-by-fast 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1 @@
1
+ MIT License
package/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # 🦄 @febin52/unique-by-fast
2
+
3
+ > Dedupe array by key or accessor function.
4
+
5
+ ```ts
6
+ import { uniqueBy } from '@febin52/unique-by-fast';
7
+ uniqueBy([{ a: 1 }, { a: 1 }], x => x.a); // [{ a: 1 }]
8
+ ```
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?n(exports):typeof define=="function"&&define.amd?define(["exports"],n):(e=typeof globalThis<"u"?globalThis:e||self,n(e.Pkg={}))})(this,function(e){"use strict";function n(u,f){const t=new Set;return u.filter(o=>{const i=f(o);return t.has(i)?!1:(t.add(i),!0)})}e.uniqueBy=n,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,3 @@
1
+ export declare function uniqueBy<T, K>(arr: T[], fn: (item: T) => K): T[];
2
+
3
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ function s(t, r) {
2
+ const e = /* @__PURE__ */ new Set();
3
+ return t.filter((u) => {
4
+ const n = r(u);
5
+ return e.has(n) ? !1 : (e.add(n), !0);
6
+ });
7
+ }
8
+ export {
9
+ s as uniqueBy
10
+ };
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@febin52/unique-by-fast",
3
+ "version": "1.0.0",
4
+ "description": "Remove duplicate array items by key or accessor function.",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc && vite build",
22
+ "test": "vitest run"
23
+ },
24
+ "keywords": [
25
+ "unique",
26
+ "uniqueBy",
27
+ "dedupe",
28
+ "array",
29
+ "distinct"
30
+ ],
31
+ "author": "Febin Francis",
32
+ "license": "MIT",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/febin52/unique-by-fast.git"
36
+ },
37
+ "bugs": {
38
+ "url": "https://github.com/febin52/unique-by-fast/issues"
39
+ },
40
+ "homepage": "https://github.com/febin52/unique-by-fast#readme"
41
+ }