@gw2treasures/helper 0.0.3 → 0.0.5

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.
@@ -0,0 +1,3 @@
1
+ export declare function groupById<T extends {
2
+ id: unknown;
3
+ }>(values: T[]): Map<T['id'], T>;
@@ -0,0 +1,7 @@
1
+ export function groupById(values) {
2
+ const map = new Map();
3
+ for (const value of values) {
4
+ map.set(value.id, value);
5
+ }
6
+ return map;
7
+ }
package/dist/is.js CHANGED
@@ -1,27 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isString = exports.isEmptyObject = exports.isFalsy = exports.isTruthy = exports.isDefined = exports.isUndefined = void 0;
4
- function isUndefined(value) {
1
+ export function isUndefined(value) {
5
2
  return value == null;
6
3
  }
7
- exports.isUndefined = isUndefined;
8
- function isDefined(value) {
4
+ export function isDefined(value) {
9
5
  return value != null;
10
6
  }
11
- exports.isDefined = isDefined;
12
- function isTruthy(value) {
7
+ export function isTruthy(value) {
13
8
  return !!value;
14
9
  }
15
- exports.isTruthy = isTruthy;
16
- function isFalsy(value) {
10
+ export function isFalsy(value) {
17
11
  return !value;
18
12
  }
19
- exports.isFalsy = isFalsy;
20
- function isEmptyObject(obj) {
13
+ export function isEmptyObject(obj) {
21
14
  return typeof obj === 'object' && obj != undefined && Object.keys(obj).length === 0;
22
15
  }
23
- exports.isEmptyObject = isEmptyObject;
24
- function isString(value) {
16
+ export function isString(value) {
25
17
  return typeof value === 'string';
26
18
  }
27
- exports.isString = isString;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@gw2treasures/helper",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "gw2treasures.com utility library",
5
5
  "exports": {
6
- "./is": {
7
- "types": "./dist/is.d.ts",
8
- "default": "./dist/is.js"
6
+ "./*": {
7
+ "types": "./dist/*.d.ts",
8
+ "default": "./dist/*.js"
9
9
  }
10
10
  },
11
11
  "scripts": {
@@ -14,7 +14,7 @@
14
14
  "build:ci": "tsc",
15
15
  "clean": "rm -rf dist/",
16
16
  "lint": "eslint src",
17
- "publish-package": "if test `npm view . version | sed -n 2p` != $npm_package_version; then npm publish --access public; else echo not changed; fi"
17
+ "publish-package": "gw2treasures-publish-package"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
@@ -30,14 +30,16 @@
30
30
  "author": "darthmaim",
31
31
  "license": "MIT",
32
32
  "bugs": {
33
- "url": "https://github.com/gw2treasures/gw2treasures.com/issues"
33
+ "url": "https://github.com/GW2Treasures/gw2treasures.com/issues"
34
34
  },
35
- "homepage": "https://github.com/gw2treasures/gw2treasures.com#readme",
35
+ "homepage": "https://github.com/GW2Treasures/gw2treasures.com#readme",
36
36
  "devDependencies": {
37
- "@tsconfig/recommended": "1.0.3",
38
- "@typescript-eslint/eslint-plugin": "6.21.0",
39
- "@typescript-eslint/parser": "6.21.0",
40
- "eslint": "8.56.0",
41
- "typescript": "5.3.3"
37
+ "@gw2treasures/eslint-config": "*",
38
+ "@gw2treasures/tsconfig": "*",
39
+ "eslint": "8.57.0",
40
+ "typescript": "5.5.4"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public"
42
44
  }
43
45
  }