Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ysuzuki19/iife.ts
IIFE for typescript
https://github.com/ysuzuki19/iife.ts
Last synced: 2 days ago
JSON representation
IIFE for typescript
- Host: GitHub
- URL: https://github.com/ysuzuki19/iife.ts
- Owner: ysuzuki19
- License: mit
- Created: 2022-02-22T14:40:06.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-24T10:53:17.000Z (3 months ago)
- Last Synced: 2024-12-17T19:03:08.946Z (10 days ago)
- Language: JavaScript
- Size: 769 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# iife library for TypeScript
```bash
$ npm i @ysuzuki19/iife.ts
```# How to use
## Sync
### After
```typescript
import iife from '@ysuzuki19/iife.ts';const num = iife(() => {
return 0;
}); // num = 0;const str = iife(() => {
return 'str';
}); // str = 'str'
```### Before
```typescript
const num = (() => {
return 0;
})();const str = (() => {
return 'str';
})();
```## Async
### Before
```typescript
const iife from '@ysuzuki19/iife.ts';const num = iife(async () => {
return 0;
}); // num = Promise{0, ...}const str = iife(async () => {
return 'str';
}); // str = Promise{'str', ...}
```