polkadot-js/client

View on GitHub
packages/client-www/src/randName.ts

Summary

Maintainability
C
7 hrs
Test Coverage
// Copyright 2017-2019 @polkadot/client-www authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.

function num (max: number): number {
  return Math.floor(Math.random() * max);
}

function val (array: string[]): string {
  return array[num(array.length)];
}

const NOUNS = [
  'variation',
  'supermarket',
  'people',
  'perspective',
  'garbage',
  'basket',
  'king',
  'apple',
  'disease',
  'payment',
  'tennis',
  'paper',
  'education',
  'math',
  'bath',
  'loss',
  'reception',
  'lake',
  'president',
  'skill',
  'strategy',
  'thought',
  'industry',
  'maintenance',
  'death',
  'sample',
  'profession',
  'emphasis',
  'library',
  'writer',
  'editor',
  'sister',
  'camera',
  'category',
  'cheek',
  'hearing',
  'opinion',
  'news',
  'girlfriend',
  'satisfaction',
  'entry',
  'introduction',
  'mall',
  'establishment',
  'physics',
  'quality',
  'surgery',
  'response',
  'pie',
  'orange',
  'teacher',
  'device',
  'excitement',
  'volume',
  'difficulty',
  'blood',
  'ad',
  'bread',
  'passion',
  'effort',
  'drawing',
  'chemistry',
  'role',
  'police',
  'injury',
  'piano',
  'way',
  'wife',
  'employee',
  'drama',
  'possession',
  'extent',
  'construction',
  'medicine',
  'hall',
  'perception',
  'property',
  'honey',
  'income',
  'argument',
  'sympathy',
  'country',
  'disaster',
  'confusion',
  'breath',
  'attention',
  'shirt',
  'examination',
  'language',
  'fortune',
  'guest',
  'obligation',
  'insurance',
  'energy',
  'enthusiasm',
  'football',
  'truth',
  'thanks',
  'impression',
  'revenue'
];

const VERBS = [
  'wipe',
  'direct',
  'debate',
  'smile',
  'decrease',
  'explode',
  'lead',
  'teach',
  'supplement',
  'witness',
  'rule',
  'interpret',
  'sue',
  'scatter',
  'wander',
  'pack',
  'concentrate',
  'escape',
  'celebrate',
  'undertake',
  'draft',
  'owe',
  'voice',
  'relax',
  'ring',
  'attend',
  'bind',
  'emphasise',
  'murmur',
  'amend',
  'stare',
  'rely',
  'appoint',
  'sense',
  'relieve',
  'lose',
  'claim',
  'suspend',
  'smoke',
  'compel',
  'extract',
  'halt',
  'proceed',
  'exist',
  'breed',
  'dispose',
  'suspect',
  'prove',
  'swallow',
  'load',
  'study',
  'influence',
  'revive',
  'dare',
  'pretend',
  'tap',
  'point',
  'dig',
  'mutter',
  'approach',
  'upset',
  'submit',
  'lower',
  'disclose',
  'scratch',
  'demand',
  'recruit',
  'confuse',
  'guarantee',
  'govern',
  'long',
  'deliver',
  'invent',
  'hide',
  'risk',
  'scream',
  'subject',
  'fire',
  'effect',
  'decorate',
  'check',
  'delay',
  'enable',
  'tremble',
  'commit',
  'complete',
  'stress',
  'calm',
  'eat',
  'equip',
  'dedicate',
  'discuss',
  'heat',
  'anticipate',
  'surprise',
  'substitute',
  'learn',
  'throw',
  'bend',
  'buy'
];

export default function randName (): string {
  return `${val(VERBS)}-${val(NOUNS)}-${num(10)}${num(10)}`;
}