Skip to content

Instantly share code, notes, and snippets.

@bibhuticoder
Created August 17, 2020 03:44
Show Gist options
  • Save bibhuticoder/cced3aa6ea35dafed82b7ddb96e192fc to your computer and use it in GitHub Desktop.
Save bibhuticoder/cced3aa6ea35dafed82b7ddb96e192fc to your computer and use it in GitHub Desktop.
import { v1 as uuidv1 } from 'uuid';
function uuid(identifier){
return identifier + '-' + uuidv1();
}
uuid('user'); // ⇨ 'user-9k1teb4d-5b7d-7b2d-9bdd-2b0d7b3dcb6d'
uuid('product'); // ⇨ 'product-6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment