ts-object-lite 2.0.1 → 2.0.3

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.
Files changed (2) hide show
  1. package/README.md +45 -0
  2. package/package.json +6 -2
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # ts-object-lite
2
+
3
+ Lightweight, type-safe object utility library for web developers.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install ts-object-lite
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { Injectable } from '@angular/core';
15
+ import { ObjectUtils } from 'ts-object-lite';
16
+
17
+ @Injectable({ providedIn: 'root' })
18
+ export class MyService {
19
+ constructor(private obj: ObjectUtils) { }
20
+
21
+ myMethod(): void {
22
+ this.obj.deepGet({a: {b: 42}}, 'a.b'); // 42
23
+ this.obj.deepClone({a: 1}); // {a: 1}
24
+ this.obj.merge({a: 1}, {b: 2}); // {a: 1, b: 2}
25
+ this.obj.omit({a: 1, b: 2}, ['b']); // {a: 1}
26
+ this.obj.pick({a: 1, b: 2}, ['a']); // {a: 1}
27
+ this.obj.isEmpty({}); // true
28
+ }
29
+ }
30
+ ```
31
+
32
+ ## Methods
33
+
34
+ | Method | Description | Example |
35
+ |--------|-------------|---------|
36
+ | `deepGet` | Get nested value | `{a:{b:42}}, 'a.b'` → `42` |
37
+ | `deepClone` | Deep clone object | `{a:1}` → `{a:1}` |
38
+ | `merge` | Merge objects | `{a:1}, {b:2}` → `{a:1,b:2}` |
39
+ | `omit` | Remove keys | `{a:1,b:2}, ['b']` → `{a:1}` |
40
+ | `pick` | Pick keys | `{a:1,b:2}, ['a']` → `{a:1}` |
41
+ | `isEmpty` | Check if empty | `{}` → `true` |
42
+
43
+ ## License
44
+
45
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-object-lite",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Lightweight, type-safe object utility library for web developers",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -26,5 +26,9 @@
26
26
  "lite"
27
27
  ],
28
28
  "author": "Gaurang Mody - G8X",
29
- "license": "MIT"
29
+ "license": "MIT",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/gbmrocks/ts-utils-lite.git"
33
+ }
30
34
  }