Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-human-ids

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-human-ids - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

data/adjectives.js

2

package.json
{
"name": "simple-human-ids",
"version": "2.0.2",
"version": "2.0.3",
"description": "Generate human-readable ids from lists of easy-to-spell words",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -22,12 +22,17 @@ const shuffle = require( 'shuffle-array' );

const defaultAdjectives = require( '../data/adjectives' );
const defaultAdverbs = require( '../data/adverbs' );
const defaultNouns = require( '../data/nouns' );
const defaultVerbs = require( '../data/verbs' );
// Construct our lists with defaults
function construct( numbers = generateNumbers(), adjectives = getList( 'adjectives' ), nouns = getList( 'nouns' ),
verbs = getList( 'verbs' ), adverbs = getList( 'adverbs' ) ){
function construct( numbers = generateNumbers(), adjectives = defaultAdjectives, nouns = defaultNouns,
verbs = defaultVerbs, adverbs = defaultAdverbs ){
// Guard against Null
const numbersInternal = numbers != null ? numbers.slice(0) : generateNumbers();
const adjectivesInternal = guardNull( adjectives, 'adjectives' );
const nounsInternal = guardNull( nouns, 'nouns' );
const verbsInternal = guardNull( verbs, 'verbs' );
const adverbsInternal = guardNull( adverbs, 'adverbs' );
const adjectivesInternal = adjectives != null ? adjectives.slice(0) : defaultAdjectives.slice(0);
const nounsInternal = nouns != null ? nouns.slice(0) : defaultNouns.slice(0);
const verbsInternal = verbs != null ? verbs.slice(0) : defaultVerbs.slice(0);
const adverbsInternal = adverbs != null ? adverbs.slice(0) : defaultAdverbs.slice(0);

@@ -45,6 +50,2 @@

function guardNull( list, name ){
return list != null ? list.slice(0) : getList( name );
}
function generateNumbers(){

@@ -65,23 +66,5 @@

let fs;
let path;
function getList( subject ){
// Import filesystem and path utilities if not already imported
if( !fs ){
fs = require( 'fs' );
}
if( !path ){
path = require( 'path' );
}
const filePath = path.join( __dirname, '..', 'data', subject + '.txt' );
const file = fs.readFileSync( filePath, 'utf8' );
return file.trim().split( '\n' );
}
module.exports.new = next;
module.exports.configure = configure;
module.exports.construct = construct;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc