Skip to content

Commit

Permalink
Merge branch 'release/v1.1.0-js' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
joooKiwi committed Aug 14, 2023
2 parents 9907767 + 4ecef7b commit 2224877
Show file tree
Hide file tree
Showing 15 changed files with 354 additions and 136 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ But other languages will be eventually added

## Version history

| JS/TS | Date | Quick note |
|-------|-----------------|---------------------------------------------|
| 1.0.1 | July 1st, 2023 | A small update of the dependencies |
| 1.0.0 | June 28th, 2023 | The first implementation used in Javascript |
| JS/TS | Date | Quick note |
|-------|-------------------|-------------------------------------------------------------------------------------------|
| 1.1.0 | August 14th, 2023 | New [CommonLazy](https://github.com/joooKiwi/lazy/blob/main/javascript/src/CommonLazy.ts) |
| 1.0.1 | July 1st, 2023 | A small update of the dependencies |
| 1.0.0 | June 28th, 2023 | The first implementation used in Javascript |
9 changes: 7 additions & 2 deletions javascript/.idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* [Usage](#usage)
* [Lazy value](#lazy-value)
* [Non-lazy value](#non-lazy-value)
* [Common lazy](#common-lazy)
* [Contribution](#contribution)

This project is a simple implementation of the [Kotlin Lazy](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-lazy/).
Expand Down Expand Up @@ -58,6 +59,37 @@ firstValue.value // 2
firstValue.isInitialized // true
```

### Common lazy

When utilizing the lazy methods,
it always creates a new instance.

But, there could be some cases where an already known value is there.

Here is the full list of the common `Lazy` instances:

| Value | With string | With character |
|----------------------------------------------------|-------------|:---------------|
| `null` | yes | |
| `undefined` | yes | |
| `true` / `false` | yes | |
| `-1` / `0` / `1` / `2` | yes | yes |
| `NaN` / `Infinity` / `-Infinity` | yes | |
| `ln(2)` / `ln(10)` | | |
| `log₂(E)` / `log₁₀(E)` | | |
| `E`, `PI` | | |
| ` ` / `\t` / `\n` | | yes |
| epoch / now / tomorrow / yesterday | | |
| invalid Date | yes | |
| empty String → `''` | | |
| empty object → `Readonly<{}>` | | |
| empty Array → `readonly []` | | |
| empty Set → `ReadonlySet<never>` | | |
| empty WeakSet → `Readonly<WeakSet<never>>` | | |
| empty Map → `ReadonlyMap<unknown, never>` | | |
| empty WeakMap → `Readonly<WeakMap<object, never>>` | | |


## Contribution
You can contribute to great simple packages.
All with similar behaviour across different languages (like Java, Kotlin, C# and PHP).
Expand Down
Loading

0 comments on commit 2224877

Please sign in to comment.