Skip to content

Commit

Permalink
Add randomphrase lib for random phrase id generation (#156)
Browse files Browse the repository at this point in the history
* Add randomphrase

* bump ver, fix vulns
  • Loading branch information
partiallyordered authored Jun 29, 2021
1 parent b08746a commit 0e87a65
Show file tree
Hide file tree
Showing 6 changed files with 14,860 additions and 32 deletions.
3 changes: 0 additions & 3 deletions package-lock.json

This file was deleted.

2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const requests = require('./lib/requests');
const request = require('./lib/request');
const WSO2Auth = require('./lib/WSO2Auth');
const { MojaloopRequests, ThirdpartyRequests } = requests;
const randomPhrase = require('./lib/randomphrase');

module.exports = {
Errors,
Expand All @@ -30,4 +31,5 @@ module.exports = {
request,
requests,
WSO2Auth,
randomPhrase,
};
21 changes: 21 additions & 0 deletions src/lib/randomphrase/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**************************************************************************
* (C) Copyright ModusBox Inc. 2019 - All rights reserved. *
* *
* This file is made available under the terms of the license agreement *
* specified in the corresponding source code repository. *
* *
* ORIGINAL AUTHOR: *
* Matt Kingston - [email protected] *
**************************************************************************/

'use strict';

const words = require('./words.json');

const randomEl = arr => arr[Math.floor(Math.random() * arr.length)];
module.exports = (separator = '-') => [
randomEl(words.adjectives),
randomEl(words.nouns),
randomEl(words.adjectives),
randomEl(words.nouns)
].join(separator);
Loading

0 comments on commit 0e87a65

Please sign in to comment.