@forklaunch/common 0.2.0 → 0.2.1

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/lib/index.d.mts CHANGED
@@ -61,4 +61,11 @@ declare function extractArgumentNames(func: {
61
61
  toString(): string;
62
62
  }): string[];
63
63
 
64
- export { type Flatten, type FlattenKeys, type FlattenValues, type MakePropertyOptionalIfChildrenOptional, type Prettify, type RemoveTrailingSlash, extractArgumentNames, isNever, isRecord };
64
+ /**
65
+ * Removes all properties with undefined values from an object. Note: this does NOT strip null values.
66
+ * @param obj The object to strip undefined properties from
67
+ * @returns A new object with all undefined properties removed
68
+ */
69
+ declare function stripUndefinedProperties<T extends Record<string, unknown>>(obj: T): Partial<T>;
70
+
71
+ export { type Flatten, type FlattenKeys, type FlattenValues, type MakePropertyOptionalIfChildrenOptional, type Prettify, type RemoveTrailingSlash, extractArgumentNames, isNever, isRecord, stripUndefinedProperties };
package/lib/index.d.ts CHANGED
@@ -61,4 +61,11 @@ declare function extractArgumentNames(func: {
61
61
  toString(): string;
62
62
  }): string[];
63
63
 
64
- export { type Flatten, type FlattenKeys, type FlattenValues, type MakePropertyOptionalIfChildrenOptional, type Prettify, type RemoveTrailingSlash, extractArgumentNames, isNever, isRecord };
64
+ /**
65
+ * Removes all properties with undefined values from an object. Note: this does NOT strip null values.
66
+ * @param obj The object to strip undefined properties from
67
+ * @returns A new object with all undefined properties removed
68
+ */
69
+ declare function stripUndefinedProperties<T extends Record<string, unknown>>(obj: T): Partial<T>;
70
+
71
+ export { type Flatten, type FlattenKeys, type FlattenValues, type MakePropertyOptionalIfChildrenOptional, type Prettify, type RemoveTrailingSlash, extractArgumentNames, isNever, isRecord, stripUndefinedProperties };
package/lib/index.js CHANGED
@@ -22,7 +22,8 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  extractArgumentNames: () => extractArgumentNames,
24
24
  isNever: () => isNever,
25
- isRecord: () => isRecord
25
+ isRecord: () => isRecord,
26
+ stripUndefinedProperties: () => stripUndefinedProperties
26
27
  });
27
28
  module.exports = __toCommonJS(index_exports);
28
29
 
@@ -63,9 +64,17 @@ function extractArgumentNames(func) {
63
64
  }
64
65
  return result;
65
66
  }
67
+
68
+ // src/utils/stripUndefinedProperties.ts
69
+ function stripUndefinedProperties(obj) {
70
+ return Object.fromEntries(
71
+ Object.entries(obj).filter(([, value]) => value !== void 0)
72
+ );
73
+ }
66
74
  // Annotate the CommonJS export names for ESM import in node:
67
75
  0 && (module.exports = {
68
76
  extractArgumentNames,
69
77
  isNever,
70
- isRecord
78
+ isRecord,
79
+ stripUndefinedProperties
71
80
  });
package/lib/index.mjs CHANGED
@@ -35,8 +35,16 @@ function extractArgumentNames(func) {
35
35
  }
36
36
  return result;
37
37
  }
38
+
39
+ // src/utils/stripUndefinedProperties.ts
40
+ function stripUndefinedProperties(obj) {
41
+ return Object.fromEntries(
42
+ Object.entries(obj).filter(([, value]) => value !== void 0)
43
+ );
44
+ }
38
45
  export {
39
46
  extractArgumentNames,
40
47
  isNever,
41
- isRecord
48
+ isRecord,
49
+ stripUndefinedProperties
42
50
  };
package/package.json CHANGED
@@ -1,51 +1,17 @@
1
1
  {
2
2
  "name": "@forklaunch/common",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Common package for base types, interfaces, implementations.",
5
- "files": [
6
- "lib/**"
7
- ],
8
- "types": "lib/index.d.ts",
5
+ "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/forklaunch/forklaunch-js/issues"
8
+ },
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "git+https://github.com/forklaunch/forklaunch-js.git"
12
12
  },
13
- "author": "Rohin Bhargava",
14
13
  "license": "MIT",
15
- "bugs": {
16
- "url": "https://github.com/forklaunch/forklaunch-js/issues"
17
- },
18
- "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
19
- "devDependencies": {
20
- "@eslint/js": "^9.17.0",
21
- "@types/jest": "^29.5.14",
22
- "argparse": "^2.0.1",
23
- "balanced-match": "^3.0.1",
24
- "brace-expansion": "^4.0.0",
25
- "entities": "^6.0.0",
26
- "eslint": "^9.17.0",
27
- "globals": "^15.14.0",
28
- "jest": "^29.7.0",
29
- "linkify-it": "^5.0.0",
30
- "lunr": "^2.3.9",
31
- "markdown-it": "^14.1.0",
32
- "mdurl": "^2.0.0",
33
- "minimatch": "^10.0.1",
34
- "punycode.js": "^2.3.1",
35
- "shiki": "^1.26.1",
36
- "ts-jest": "^29.2.5",
37
- "ts-node": "^10.9.2",
38
- "tsup": "^8.3.5",
39
- "typedoc": "^0.27.6",
40
- "typescript": "^5.7.3",
41
- "typescript-eslint": "^8.19.1",
42
- "uc.micro": "^2.1.0",
43
- "vitest": "^2.1.8",
44
- "yaml": "^2.7.0"
45
- },
46
- "directories": {
47
- "test": "tests"
48
- },
14
+ "author": "Rohin Bhargava",
49
15
  "exports": {
50
16
  ".": {
51
17
  "types": "./lib/index.d.ts",
@@ -54,14 +20,33 @@
54
20
  "default": "./lib/index.js"
55
21
  }
56
22
  },
23
+ "types": "lib/index.d.ts",
24
+ "directories": {
25
+ "test": "tests"
26
+ },
27
+ "files": [
28
+ "lib/**"
29
+ ],
30
+ "devDependencies": {
31
+ "@eslint/js": "^9.18.0",
32
+ "depcheck": "^1.4.7",
33
+ "eslint": "^9.18.0",
34
+ "globals": "^15.14.0",
35
+ "tsup": "^8.3.5",
36
+ "typedoc": "^0.27.6",
37
+ "typescript": "^5.7.3",
38
+ "typescript-eslint": "^8.20.0",
39
+ "vitest": "^3.0.2"
40
+ },
57
41
  "scripts": {
58
- "test": "vitest --passWithNoTests",
59
42
  "build": "tsc --noEmit && tsup index.ts --format cjs,esm --no-splitting --tsconfig tsconfig.json --outDir lib --dts --clean",
43
+ "check": "depcheck",
60
44
  "clean": "rm -rf lib pnpm.lock.yaml node_modules",
61
45
  "docs": "typedoc --out docs *",
46
+ "format": "prettier --ignore-path=.prettierignore --config .prettierrc '**/*.{ts,tsx,json}' --write",
62
47
  "lint": "eslint . -c eslint.config.mjs",
63
48
  "lint:fix": "eslint . -c eslint.config.mjs --fix",
64
- "format": "prettier --ignore-path=.prettierignore --config .prettierrc '**/*.ts' --write",
65
- "publish:package": "./publish-package.bash"
49
+ "publish:package": "./publish-package.bash",
50
+ "test": "vitest --passWithNoTests"
66
51
  }
67
52
  }