New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@cuties/created

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cuties/created

Creates objects with async arguments.

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

cutie-created

NPM Version Build Status codecov

Cutie extension for creating objects with async arguments. It's based on the Async Tree Pattern.

Install

npm install @cuties/created

Run test

npm test

Run build

npm run build

Example

Let's say you have an object User:

class User {
  constructor (name, email) {
    this.name = name
    this.email = email
  }
}

But in some cases you can get name and email only via async calls, so you need User to have async arguments, but User is not an async object. This lib provides the object Created, which solves the problem.

const { Created } = require('@cuties/cutie')
const User = require('./User')

new Created(
  User, new RetrievedSomehowUserName(), new RetrievedSomehowUserEmail()
).call()

And in this case Created represents User with properties from the specified async objects.

So, the signature of Created is

new Created(ObjThatYouNeedToCreate, ...asyncArgsOfObjThatYouNeedToCreate)

Keywords

cutie

FAQs

Package last updated on 11 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts