Skip to content

Commit cb0c582

Browse files
committed
Initial commit
0 parents  commit cb0c582

File tree

8 files changed

+4946
-0
lines changed

8 files changed

+4946
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Node
2+
node_modules
3+
*.tgz

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
13.3.0

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# @testingrequired/lazy
2+
3+
Wrap an object to make its methods lazily evaluate.
4+
5+
## Installation
6+
7+
`$ npm i @testingrequired/lazy`
8+
9+
## Usage
10+
11+
```javascript
12+
import assert from "assert";
13+
import Lazy from "@testingrequired/lazy";
14+
15+
const lazyAssert = Lazy.of(assert);
16+
17+
lazyAssert.ok(false); // Does nothing
18+
lazyAssert.ok(false)(); // Runs assertion
19+
20+
// This also works
21+
const okFn = lazyAssert.ok(false); // Does nothing
22+
okFn(); // Runs assertion
23+
24+
// Works with functions too
25+
const hello = Lazy.fn(name => console.log(`Hello ${name}`));
26+
const helloWorld = hello("World"); // Does nothing
27+
const helloWorld(); // Hello World
28+
```

0 commit comments

Comments
 (0)