How to use unique-random - 1 common examples

To help you get started, we’ve selected a few unique-random 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 benfluleck / HelloBooks / server / src / models / books.js View on Github external
import sentenceCase from 'sentence-case';
import uniqueRandom from 'unique-random';
import dotenv from 'dotenv';

dotenv.config();
const randomId =
uniqueRandom(process.env.ISBNRANDOM_MIN_ID, process.env.ISBNRANDOM_MAX_ID);

export default(sequelize, DataTypes) => {
  const Books = sequelize.define('Books', {
    title: {
      type: DataTypes.STRING,
      allowNull: false,
      trim: true,
      unique: 'compositeIndex'
    },
    author: {
      type: DataTypes.STRING,
      allowNull: false,
      trim: true,
      unique: 'compositeIndex',
    },
    ISBN: {

unique-random

Generate random numbers that are consecutively unique

MIT
Latest version published 9 months ago

Package Health Score

64 / 100
Full package analysis

Popular unique-random functions