1.0.2 • Published 7 months ago

@undownding/promise v1.0.2

Weekly downloads
-
License
-
Repository
github
Last release
7 months ago

Promise

Promise with props() and all()

Install

npm install @undownding/promise

Usage

import Promise, { all, props } from '@undownding/promise'

test('test with promise.props', async () => {
  const result = await Promise.props({
    a: Promise.resolve(1),
    b: Promise.resolve(2),
  })
  expect(result).toEqual({ a: 1, b: 2 })
})

test('test with all', async () => {
  const result = await all([Promise.resolve(1), Promise.resolve(2)])
  expect(result).toEqual([1, 2])
})

test('test with props', async () => {
  const result = await props({
    a: Promise.resolve(1),
    b: Promise.resolve(2),
  })
  expect(result).toEqual({ a: 1, b: 2 })
})
1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

1 year ago