How to use uid-promise - 3 common examples

To help you get started, we’ve selected a few uid-promise examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bukinoshita / taskr / renderer / services / local-storage.js View on Github external
return new Promise(async (resolve, reject) => {
    if (!title) {
      return reject(new TypeError('title is required'))
    }

    const { user } = getUser()
    const id = await uid(20)
    const task = {
      id,
      title,
      description,
      project,
      createdAt: new Date(),
      updatedAt: new Date(),
      type: tab.toLowerCase()
    }
    const tasks = [...user.tasks, task]
    user.tasks = tasks

    resolve(localStorage.setItem('taskr', JSON.stringify({ user })))
  })
}

uid-promise

generates a cryptographically strong random uid

MIT
Latest version published 1 year ago

Package Health Score

73 / 100
Full package analysis

Popular uid-promise functions

Similar packages