2.19.147 • Published 10 months ago

@firanorg/exercitationem-debitis-laborum v2.19.147

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@firanorg/exercitationem-debitis-laborum

Generate one or more common English words

@firanorg/exercitationem-debitis-laborum generates random words for use as sample text. We use it to generate random blog posts when testing Apostrophe.

Cryptographic-quality randomness is NOT the goal, as speed matters for generating sample text and security does not. As such, Math.random() is used in most cases.

The seed option can be used with the generate function for situations that require deterministic output. When given the same seed with the same input, generate() will yield deterministic results, in regards to both actual word selection and the number of words returned (when using min and max). The underlying implementation of this option utilizes the seedrandom package as a replacement for Math.random().

The count function can be used to calculate the total number of words in the word list that meet the specified minimum and maximum length criteria.

Installation:

npm install @firanorg/exercitationem-debitis-laborum

Examples:

import { generate, count } from "@firanorg/exercitationem-debitis-laborum";

console.log(generate());
//output: 'army'

console.log(generate(5));
//output: ['army', 'beautiful', 'became', 'if', 'actually']

console.log(generate({ minLength: 2 }));
//output: 'hello'

console.log(generate({ maxLength: 6 }));
//output: 'blue'

console.log(generate({ minLength: 5, maxLength: 5 }));
//output : 'world'

console.log(generate({ minLength: 11, maxLength: 10000 })); //maxLength limited to the longest possible word
//output: 'environment'

console.log(generate({ minLength: 10000, maxLength: 5 })); //minLength limited to the maxLength
//output: 'short'

console.log(generate({ min: 3, max: 10 }));
//output: ['became', 'arrow', 'article', 'therefore']

console.log(generate({ exactly: 2 }));
//output: ['beside', 'between']

console.log(generate({ min: 2, max: 3, seed: "my-seed" }));
//output: ['plenty', 'pure']

// this call will yield exactly the same results as the last since the same `seed` was used and the other inputs are identical
console.log(generate({ min: 2, max: 3, seed: "my-seed" }));
//output: ['plenty', 'pure']

console.log(generate({ exactly: 5, join: " " }));
//output: 'army beautiful became if exactly'

console.log(generate({ exactly: 5, join: "" }));
//output: 'armybeautifulbecameifexactly'

console.log(generate({ exactly: 2, minLength: 4 }));
//output: ['atom', 'window']

console.log(generate({ exactly: 5, maxLength: 4 }));
//output: ['army', 'come', 'eye', 'five', 'fur']

console.log(generate({ exactly: 2, minLength: 3, maxLength: 3 }));
//output: ['you, 'are']

console.log(generate({ exactly: 3, minLength: 5, maxLength: 100000 }));
//output: ['understanding', 'should', 'yourself']

console.log(generate({ exactly: 5, wordsPerString: 2 }));
//output: [ 'salt practical', 'also brief', 'country muscle', 'neighborhood beyond', 'grew pig' ]

console.log(generate({ exactly: 5, wordsPerString: 2, separator: "-" }));
//output: [ 'equator-variety', 'salt-usually', 'importance-becoming', 'stream-several', 'goes-fight' ]

console.log(
  generate({
    exactly: 5,
    wordsPerString: 2,
    formatter: (word) => word.toUpperCase(),
  })
);
//output: [ 'HAVING LOAD', 'LOST PINE', 'GAME SLOPE', 'SECRET GIANT', 'INDEED LOCATION' ]

console.log(
  generate({
    exactly: 5,
    wordsPerString: 2,
    formatter: (word, index) => {
      return index === 0
        ? word.slice(0, 1).toUpperCase().concat(word.slice(1))
        : word;
    },
  })
);
//output: [ 'Until smoke', 'Year strength', 'Pay knew', 'Fallen must', 'Chief arrow' ]

console.log(count());
//output: 1952

console.log(count({ minLength: 5 }));
//output: 1318 

console.log(count({ maxLength: 7 }));
//output: 1649

console.log(count({ minLength: 5, maxLength: 7 }));
//output: 1015
styleguidefileremovecloudfronthas-ownjsonregular expressiontraversetrimEndroute53bannermiddlewareRFC-6455ajaxpositivePushobjectimportInt8Arraysuperstructcollection.es6RxhookformUint8ArrayenvsigtermdirmatcheswatchFiletapeES7emojiclassnamesloggernopeassertparentstoolssettingstesthttpsinferencetypaniondomgetPrototypeOfFunction.prototype.nameguidec2ECMAScript 2016windowsutilityObject.entriescss variableECMAScript 2022mkdirpbytecolourCSSStyleDeclarationWeakMaptypescriptefficientmochaschemasharedarraybufferURLSearchParamspasswordmetadatahasOwnes2017elbnested csspackage.jsonelectronchaimimetypesasyncdefineiamfpsvariables in cssPromiseinternal slotratelimitenvironmentgetoptECMAScript 6outputemitWebSocketflatMaptaskieRegExp.prototype.flagsdependency managercompilerapicryptominimaljestbootstrap cssdeepcopywidthchromepromisesinatravariablescryptfunctionswordbreakiteratorecmascriptreal-timeUint16Arrayhardlinksidlemimesymlinksutilfull-widthdayjstslibprotologtypesafeprunesortStyleSheetreduxJSON-Schemabusyshimsigint@@toStringTagimmerbluebirdwhicheverykinesisbrowserassertslesscssconnectString.prototype.trimfastfigletsyntaximportexportobjperformantformattingsqsReactiveXTypeBoxpreserve-symlinkswatchingdataViewoptimisttypedarraystreams2dataviewcss nestingES2021stringifierirqtrimRightcolumnarraybufferregular expressionsyamlpluginautoprefixera11ycallbindArray.prototype.flattenECMAScript 3recursivecode pointsstoragegatewayrm -rfformbundlinggetfixed-widthhandlersboundargv[[Prototype]]offsetbufferBigInt64Arrayserializerm -frMapinspects3ES3frommatchAllqueryswfreplayforEachloggingmulti-packagefunctionalhasOwnPropertyspeederror-handlingauthenticationlinewrapBigUint64ArrayES2016exit-codegrouprateownnamefast-deep-copystatussymbolReflect.getPrototypeOftoArraysafeelasticacheredactrangeerrorgdprmruspinnersextensionless compilerArray.prototype.flatFloat32ArraysymbolsviewinvariantutilitieseslintpluginArray.prototype.findLastzeroObject.getPrototypeOfTypedArraytakeflattensignalseast-asian-widthrmdirwgetargsmapreducefullwidthcomputed-typesdeterministicformscommand-lineruntimecheckagentsetImmediateArray.prototype.filteroptiontermarktypebdduninstallcss-in-jsreact-hook-formdeepcloneprototypecharactersObject.fromEntriesUint32ArraydotenvregularAsyncIteratorqsduplexcommandglacierless mixinskoreanclassnameinterruptsvalidatelimitexecstringifycreateflagES2017rapidsideMicrosoftes-shim APIpathenderRegExp#flagswafrequirejsxfseventsfinduppredictablegradients cssstylingttycloudwatchmkdirsdroppushcommanderrouterTypeScripthigher-orderapprdsECMAScript 2023jsonpathautoscalingnegativecolumnsloadbalancingbeanstalkkarmasnsweakmapiterationconsoleresolve-0propECMAScript 2017exitcloudtrailargumentstylestoStringTagio-tspyyamlbyteOffsetisConcatSpreadablecallboundrgbArray.prototype.contains_.extendworkercloudformationclass-validatorhasSymbolnumberendpointyupwhatwggettertc39es5writablecolorpostcss-pluginreadablestreamObservablesflagscloneescapeglobArray.prototype.includesindicatorperformanceurltrimairbnbjsdiffworkspace:*less csskeysObject.keysloadingsuperagentHyBibrowserslistscheme-validationartoncetypeerrorconfigurabledeletecorsprettybundlerES8bindmake dirESnextArrayBufferdebugrequestArray.prototype.flatMaptextObject.isstablecallArrayBuffer#slicees8visualdefinePropertyentriesfast-clone0expresscolorsWebSocketsprogresscodesinstallerexpressioncoerciblefast-deep-cloneintrinsicterminaltesterreducersameValueZerojapaneseinstallmixinsjoiECMAScript 2018fastclonedependenciesl10nes2016private dataUint8ClampedArraysequencefluxzodshellfind-upjavascriptfindmodulesconcurrencyfast-copydescriptorflatquerystringprivatepostcssdescriptorsequalerrortapES2019propertyes2015fastcopyserializationrandomisdom-testing-librarywriteansifindLastIndexstdliblimitedwordwrapreusemaketestingroutingmime-dbmergetsasciimobileECMAScript 5typessetYAMLIteratordebuggerreadqueueMicrotaskestreeRxJSform-validationeslint-pluginprocessparentparseassertionlookdiffconcatMaplinuxstreamsInt32Arraywatches-shimslinklanguageES2018consumestylesheetmkdirfetchemrconcatsignalelmvesthelperses-abstractsesthroatreactmonorepoclasseses6parsingnpmupstarterCSS
2.19.147

10 months ago

2.19.146

10 months ago

2.18.146

10 months ago

2.17.132

11 months ago

2.17.133

11 months ago

2.17.134

11 months ago

2.17.135

11 months ago

2.17.130

11 months ago

2.17.131

11 months ago

2.17.129

11 months ago

2.18.139

10 months ago

2.18.137

10 months ago

2.18.138

10 months ago

2.18.135

10 months ago

2.18.136

10 months ago

2.18.144

10 months ago

2.18.145

10 months ago

2.18.142

10 months ago

2.18.143

10 months ago

2.18.140

10 months ago

2.18.141

10 months ago

2.17.127

11 months ago

2.17.128

11 months ago

2.17.125

11 months ago

2.17.126

11 months ago

2.17.124

11 months ago

2.17.121

11 months ago

2.17.122

11 months ago

2.17.123

11 months ago

2.17.120

11 months ago

2.17.118

11 months ago

1.17.118

11 months ago

2.17.119

11 months ago

1.17.117

11 months ago

1.17.116

11 months ago

1.17.115

11 months ago

1.17.114

11 months ago

1.17.113

11 months ago

1.17.112

11 months ago

1.17.111

11 months ago

1.17.109

11 months ago

1.17.110

11 months ago

1.17.108

11 months ago

1.17.107

11 months ago

1.17.106

12 months ago

1.17.105

12 months ago

1.17.104

12 months ago

1.16.104

12 months ago

1.16.103

12 months ago

1.16.102

12 months ago

1.16.101

12 months ago

1.14.87

1 year ago

1.14.88

1 year ago

1.14.89

1 year ago

1.6.42

1 year ago

1.6.41

1 year ago

1.6.44

1 year ago

1.6.43

1 year ago

1.12.69

1 year ago

1.6.46

1 year ago

1.6.45

1 year ago

1.6.47

1 year ago

1.4.37

1 year ago

1.4.36

1 year ago

1.4.39

1 year ago

1.4.38

1 year ago

1.10.62

1 year ago

1.10.63

1 year ago

1.10.61

1 year ago

1.3.35

1 year ago

1.3.36

1 year ago

1.3.34

1 year ago

1.14.90

12 months ago

1.1.19

1 year ago

1.14.91

12 months ago

1.14.92

12 months ago

1.12.73

1 year ago

1.15.101

12 months ago

1.14.93

12 months ago

1.12.70

1 year ago

1.15.100

12 months ago

1.14.94

12 months ago

1.12.72

1 year ago

1.12.71

1 year ago

1.8.56

1 year ago

1.8.57

1 year ago

1.8.58

1 year ago

1.1.23

1 year ago

1.1.22

1 year ago

1.1.21

1 year ago

1.1.20

1 year ago

1.1.27

1 year ago

1.1.26

1 year ago

1.1.25

1 year ago

1.1.24

1 year ago

1.15.98

12 months ago

1.13.75

1 year ago

1.15.99

12 months ago

1.13.74

1 year ago

1.13.77

1 year ago

1.13.76

1 year ago

1.15.94

12 months ago

1.15.95

12 months ago

1.15.96

12 months ago

1.13.73

1 year ago

1.15.97

12 months ago

1.7.50

1 year ago

1.7.51

1 year ago

1.7.52

1 year ago

1.9.61

1 year ago

1.7.53

1 year ago

1.9.60

1 year ago

1.7.54

1 year ago

1.13.79

1 year ago

1.7.55

1 year ago

1.13.78

1 year ago

1.7.56

1 year ago

1.9.59

1 year ago

1.9.58

1 year ago

1.5.41

1 year ago

1.5.40

1 year ago

1.4.40

1 year ago

1.2.27

1 year ago

1.2.28

1 year ago

1.13.80

1 year ago

1.2.29

1 year ago

1.13.86

1 year ago

1.11.63

1 year ago

1.13.85

1 year ago

1.11.64

1 year ago

1.13.87

1 year ago

1.13.82

1 year ago

1.13.81

1 year ago

1.13.84

1 year ago

1.13.83

1 year ago

1.11.69

1 year ago

1.11.67

1 year ago

1.2.30

1 year ago

1.11.68

1 year ago

1.2.31

1 year ago

1.11.65

1 year ago

1.11.66

1 year ago

1.7.47

1 year ago

1.7.48

1 year ago

1.2.34

1 year ago

1.7.49

1 year ago

1.2.32

1 year ago

1.2.33

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.0.16

1 year ago

1.1.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago