2.4.67 • Published 5 months ago

@zitterorg/occaecati-beatae v2.4.67

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

@zitterorg/occaecati-beatae

Generate one or more common English words

@zitterorg/occaecati-beatae 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 @zitterorg/occaecati-beatae

Examples:

import { generate, count } from "@zitterorg/occaecati-beatae";

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
bindayjsservicezeroajvvalidatetoStringTagbannerreduxserverdeletemapreduceECMAScript 2023reactTypeBoxproxyObjectformup@@toStringTagconfigperformantpropertysettingsdatarestfulObject.assignrm -frchildasciispecsubprocessenvironmentsidentifierskarmacreatefast-copyvaluespostcss-plugindescriptionwritabledependenciesECMAScript 2016terminalmkdirpajaxhigher-orderutilitiescommandECMAScript 3prettyjapaneseawslocationtc39getOwnPropertyDescriptorkeyObject.valuesworkspace:*getaccessorprunevariablessomeshells3deepcharacterkinesiswidthpoint-freewebvisualclientrouteflatflatMapcommand-lineecmascriptspringpurehardlinksES2017hashObject.entriesWeakMapRFC-6455bdddirequalityhas-ownieparseObservablessnstacitjoiloadbalancingbinariesremoveclassnamestestperformanceprivate dataloggererrorlistenersreducerforkfnmatchcallboundlogES8astfast-deep-copycode pointspackageswhichregular expressionignoretoArraylogging-0StreamsObject.getPrototypeOfiamcallbindsortspinnerenvironmentvpccjkdom-testing-libraryweakmapArray.prototype.flattenglobalreadcallchecknegativeflagistanbulfromconsoleavaprivateelbdeepclonevarstringifieranimationbindrmdirInt16Arrayswfinternal slotfunctionECMAScript 2020toSorteddefinePropertyisConcatSpreadablees5popmotionminimaljsdomnpmmergenopeprotodotenvfind-uptoobjectclassname3dObservableexecbyteLengthshimprefixaccessibilitysyntaxerrorpostcsslook-upsafedeep-copycss-in-jsStreamlanguageclass-validatornodeArray.prototype.filtertoolkitfastclonevalidationtypaniontypedarraysemojicollection.es6bundlerRxJSbusystoragegatewaynativeframerTypedArraytimefullisrandomjsdiffbyteOffsettoReversedidhttplibphonenumberl10nECMAScript 2022ES6haseventsspinnerscryptolookspawnconstconsumemkdirsstyled-componentscopy[[Prototype]]chromiumSymbol.toStringTagflattencurlurlIteratorES5TypeScriptRegExp.prototype.flagstddcloudformationECMAScript 2018Array.prototype.includesmanipulationES2016pluginregularharmonyES3uuideslintiterategesturesURLgetPrototypeOfcolourtrimRightbuffersharedfunctionsreact-testing-librarystarterfile cachefetchhasOwnPropertyoptioncloudtrailrequirefullwidththreestyleArray.prototype.flatMapframeworkes-shim APIxmlfastsideregular expressionsconcatMapflagsimmerarrayspnpm9.envclidateESECMAScript 2019includesformatstableautoscalingjavascriptFloat64Arrayrfc4122groupByoutputeffect-tsback-endfigletglaciertesterECMAScript 2015curriedtypeintrinsicECMAScript 7$.extendagenta11yenumerablequerystringPromiseyupqueueMicrotaskdebuggerxhrjsonentriesshebangchromecloudsearchsimple cacheString.prototype.trimES2020AsyncIteratordeepcopyfindupbundlinghelpergitignorelockfileinternalvarssuperstructpathlruestreeansireducetriminreact-hook-formtrimStartsqshelpersRegExp#flagsjasminetextdebugtslibexpresstransportvalueutilsbrowsertypesafeeventEmittertranspileletfindLastviewmoduleairbnbfunction.lengthsameValueZeroES2015fsfantasy-landdataViewtakegenericsvestreworkeventDispatcherargstestingschemecodesnamesescaperesolvees8SymbolimmutabletelephoneutilityReactiveExtensionsclassesutil.inspectemrworkerES2019protobufqsawesomesaucesimpledbStyleSheetappECMAScript 5fast-deep-clonegroupredux-toolkitbyteslicepipemrudynamodbsetPrototypeOflinksuperagentcore-jselectroncall-boundpicomatchoffsetchinesejsendpointwhatwgindicatorwriteglobalsFloat32ArrayidleconfigurablesyntaxserializermatchstringwarningtsrangeerrorunicodeshrinkwraphttpsprogressredirectequalmockYAMLdragBigInt64Arrayespreestyleguideec2rsschannelfindLastIndexamazonbrowserslistmomenthasOwnserializesource mapReflect.getPrototypeOfrouterdependency manageronceMapES2018speedsymbolsprocessWebSocketsmove
2.4.67

5 months ago

2.4.65

5 months ago

2.4.64

5 months ago

2.4.66

5 months ago

2.4.63

5 months ago

2.3.63

5 months ago

2.3.62

5 months ago

2.2.62

5 months ago

2.2.59

5 months ago

2.2.60

5 months ago

2.2.61

5 months ago

2.2.57

5 months ago

2.2.58

5 months ago

2.2.55

5 months ago

2.2.56

5 months ago

2.2.18

6 months ago

2.2.53

5 months ago

2.2.54

5 months ago

2.2.51

5 months ago

2.2.52

5 months ago

2.2.50

5 months ago

2.2.19

6 months ago

2.2.28

6 months ago

2.2.29

6 months ago

2.2.26

6 months ago

2.2.27

6 months ago

2.2.24

6 months ago

2.2.25

6 months ago

2.2.22

6 months ago

2.2.23

6 months ago

2.2.20

6 months ago

2.2.21

6 months ago

1.2.17

6 months ago

1.2.18

6 months ago

2.2.39

6 months ago

2.2.37

6 months ago

2.2.38

6 months ago

2.2.35

6 months ago

2.2.36

6 months ago

2.2.33

6 months ago

2.2.34

6 months ago

2.2.31

6 months ago

2.2.32

6 months ago

2.2.30

6 months ago

2.2.48

5 months ago

2.2.49

5 months ago

2.2.46

5 months ago

2.2.47

5 months ago

2.2.44

6 months ago

2.2.45

6 months ago

2.2.42

6 months ago

2.2.43

6 months ago

2.2.40

6 months ago

2.2.41

6 months ago

1.2.16

7 months ago

1.2.13

7 months ago

1.2.14

7 months ago

1.2.15

7 months ago

1.1.13

7 months ago

1.1.12

7 months ago

1.1.11

7 months ago

1.1.10

7 months ago

1.1.9

7 months ago

1.1.8

7 months ago

1.1.7

7 months ago

1.1.6

7 months ago

1.1.5

7 months ago

1.1.4

7 months ago

1.1.3

7 months ago

1.1.2

7 months ago

1.1.1

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago