1.0.2 • Published 3 years ago

@ysuzuki19/iife.ts v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

iife library for TypeScript

$ npm i @ysuzuki19/iife.ts

How to use

Sync

After

import iife from '@ysuzuki19/iife.ts';

const num = iife(() => {
  return 0;
}); // num = 0;

const str = iife(() => {
  return 'str';
}); // str = 'str'

Before

const num = (() => {
  return 0;
})();

const str = (() => {
  return 'str';
})();

Async

Before

const iife from '@ysuzuki19/iife.ts';

const num = iife(async () => {
  return 0;
}); // num = Promise{0, ...}

const str = iife(async () => {
  return 'str';
}); // str = Promise{'str', ...}