@farbenmeer/lacy 0.2.0 → 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/README.md +30 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @farbenmeer/lacy
|
|
2
|
+
|
|
3
|
+
Lightweight utility for lazy evaluation of JavaScript promises. Chain property access and method calls without awaiting intermediate values.
|
|
4
|
+
|
|
5
|
+
**[Documentation](https://oss-docs.apps.farbenmeer.de/lacy/)** | **[GitHub](https://github.com/farbenmeer/tapi/tree/main/packages/1-lacy)** | **[npm](https://www.npmjs.com/package/@farbenmeer/lacy)**
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { lacy } from "@farbenmeer/lacy";
|
|
9
|
+
|
|
10
|
+
// Instead of this:
|
|
11
|
+
const response = await fetch("/api/users");
|
|
12
|
+
const data = await response.json();
|
|
13
|
+
const name = data[0].name;
|
|
14
|
+
|
|
15
|
+
// Write this:
|
|
16
|
+
const name = await lacy(fetch("/api/users")).json()[0].name;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @farbenmeer/lacy
|
|
23
|
+
yarn add @farbenmeer/lacy
|
|
24
|
+
pnpm add @farbenmeer/lacy
|
|
25
|
+
bun add @farbenmeer/lacy
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## License
|
|
29
|
+
|
|
30
|
+
MIT
|