1.3.76 • Published 11 months ago

@dramaorg/animi-nesciunt v1.3.76

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

@dramaorg/animi-nesciunt

Lightweight util for generating random sentences, paragraphs and articles in English. Inspired by Sentencer and metaphorpsum.com.

NPM CI test Coverage Status CodeQL

Demo

Setup

Usage

Node.js:

import {
  sentence
} from '@dramaorg/animi-nesciunt'

// with CommonJS environment
// const { sentence } = require('@dramaorg/animi-nesciunt/dist/cjs/@dramaorg/animi-nesciunt.js')

sentence()

Browsers:

Currently, ECMAScript modules work fine on almost all browsers:

<script type="module">
import { sentence } from 'https://unpkg.com/@dramaorg/animi-nesciunt/dist/@dramaorg/animi-nesciunt.esm.js'
console.log(sentence())
</script>

With outdated browsers, we can use the traditional method:

<script type="text/javascript" src="https://unpkg.com/@dramaorg/animi-nesciunt/dist/@dramaorg/animi-nesciunt.min.js"></script>

<script>
console.log(window.@dramaorg/animi-nesciunt.sentence())
</script>

APIs

  • .sentence()
  • .paragraph([Number totalSentences])
  • .article([Number totalParagraphs])
  • .addNouns(Array nouns)
  • .addAdjectives(Array adjectives)
  • .addTemplates(Array sentenceTemplates)
  • .setNouns(Array nouns)
  • .setAdjectives(Array adjectives)
  • .setTemplates(Array sentenceTemplates)
  • .getNouns()
  • .getAdjectives()
  • .getTemplates()
  • .lorem([Number min [, Number max]])

As their name suggests, we have 4 groups of methods:

  • sentence(), paragraph(), article(): generate text by given grammatical unit
  • addNouns(), addAdjectives(), addTemplates(): add more samples to current sample set
  • setNouns(), setAdjectives(), setTemplates(): replace current sample set with new ones
  • getNouns(), getAdjectives(), getTemplates(): get current sample set

The set* and get* methods were added in v2.2.3 to help you customize your sample data.

In addition, we've added lorem() method since v3.0.5 to generate lorem ipsum text.

Template

If you want to add more kinds of sentences, just use the .addTemplates() method; it expects a list of sentence templates. Each sentence template is an English sentence, containing placeholders that can be replaced with any alternative word.

For example:

import {
  addTemplates
} from '@dramaorg/animi-nesciunt'

const templates = [
  '{{a_noun}} is {{a_noun}} from the right perspective',
  'the {{noun}} of {{a_noun}} becomes {{an_adjective}} {{noun}}'
]

addTemplates(templates)

Here are the available placeholders:

  • noun
  • nouns
  • a_noun
  • adjective
  • an_adjective

Lorem ipsum

Syntax:

lorem() // generate a random phrase with length from 2 to 24 words of lorem ipsum
lorem(Number min) // set the minimum number of words
lorem(Number min, Number max)// set the minimum/maximum number of words

Example:

import { lorem } from '@dramaorg/animi-nesciunt'

const phrase = lorem()
console.log(phrase) // => nisi blandit feugiat tempus imperdiet etiam eu mus augue

Test

git clone https://github.com/dramaorg/animi-nesciunt.git
cd @dramaorg/animi-nesciunt
npm install
npm test

License

The MIT License (MIT)

atomasyncstyleguidelrudescriptorsSymbolRegExp.prototype.flagskorean@@toStringTagreadtoolsanimationvarsECMAScript 2018globalsES2015AsyncIteratorquoteCSSStyleDeclarationargvStreamsgitignoretypeelectrongetOwnPropertyDescriptorinternalfast-deep-clonefsSetjsdifftestingES2018utilsutilArrayBufferqueueMicrotask6to5HyBiec2flagscurlarraybufferReactiveXfixed-widthArrayBuffer#slicepoint-free-0pipecolumnnope.envhttpsmobiletraversetakestreamshas-ownjsonschemaisConcatSpreadableidlewaitjsxerrortapcomparekeysetterscheme-validationkeysinstallertrimpostcsstranspilerloadingincludesflatfastrfc4122speedobjpushIteratorfastclonereadabletypescriptidentifiersstringbddrmdirfeedreduxObjectterminalsortzxreact-hooks3dprotocol-bufferswritablemkdirserializationcurriedecmascriptgesturesforkiefastcopyramdaeveryES2017bytehashURLArray.prototype.findLastIndexArray.prototype.findLastwaapipatchchildshimfiglettyped arraytypesbundlingstringifyInt8Arraydependency managerpositivenodejsestreefullwidthbundlerenumerablereversedpluginastfast-copyrequiregetintrinsicexpressiondirectoryemrfpsperformantmatchAllObject.issinatravaluetypedarrayredux-toolkitESnextpropertyhookformdropmkdirsgrouploggingescapedynamodbfastifybabelenvironmentsJSONcopyproptoReverseddataViewregular-expressionisshebangjson-schema256ES3es2018slotimmutablees-abstracthasOwnjsdeterministiccall-bindshrinkwrapflatMapcensorYAMLl10nasciilistenersinstrumentationrestmanipulationECMAScript 2021deletesymbolssafestylingcryptoeslintpluginhooksseti18nfast-clonereusevarjshintdebuggerproxyconstendpointcsstrimEndWeakMapairbnbdescriptorperformanceupoutputtoStringTagnegativesomeform-validationprogresscolumnses8full-widthECMAScript 2020routespringuuidnpmignoretesterequaltsvestruntimexmlclassesArray.prototype.includesprettytostringtagconfigbuffersUint16Arraydomreverseparentpostcss-pluginfetchObject.keyses-shim APIES5Object.fromEntriesdebugschemeposetrimStarttransformjson-schema-validationstoragegatewaymoduleECMAScript 2022mergeglaciersameValueZerofpArray.prototype.flattenes6byteLengthfilepathTypeScriptregular expressionvalidinputebsprotocode pointsES2022sescallbindsearchcolorsfindextendCSSwriteReactiveExtensionsString.prototype.matchAlldataviewspawnhelpersconsoleredirecttacitECMAScript 2017a11ydeepcopyworkspace:*coercibleUnderscorecloudformationpackage managerlockfileWeakSetflattenES2020busysymbolrgbtypedformatdirweaksethtmlasterisksacornoptimizerObservablepyyamlpolyfillmatchesappkinesisentriescachearrayrecursiveemitdescriptioneslintserializeprocessponyfillviewlintconcatMapwindowfunctionalbeanstalkcommanderworkflowtestimmerreact-hook-formminimalvisualFunction.prototype.nameString.prototype.trimfindLastdayjsdotenvjsdomFloat64ArrayexecfileTypeBoxserializeroptimistrangeerroreventsvalidationreworkcoredeep-copytypesafewalkUint32ArraybyteOffsetpruneES8function.lengthmkdirppreprocessorprefixboundutilitiesautoprefixerECMAScriptjapaneseiterateeslintconfigreact pose0es2016$.extendguidwebobjectio-tsclonephoneparsesqscolourparentsapollotelephonedeepcloneWebSocketsclass-validatorstructuredCloneindicatorfindupbuffermanageres2015emojiartparserdragequalityremovetimetapemodulesglobal this valuerdsxhrcloudfrontchromiumregexES7regularutilityObject.getPrototypeOfregular expressionsamazontrimRightformsbininchannelstreamsideWebSocketkarmawgetsource mapinstallspinnerECMAScript 5whiches2017jasminematchbrowserexecutemapcjkJSON-SchemaStreames7functionRxJSprivate dataES2023propertiesECMAScript 2015languagedependenciesvalidatorutil.inspectthreewarningenvfullsuperagentglobal objectcloudwatchextrawafsetPrototypeOfajaxidargumentgdprpackagecharactersajvjsonvariablestranspiletoolkitlocationintrinsicsliceESfind-upjestmapreducenegative zeronameszodonceprototypewhatwgreactiteratoreast-asian-widthgetoptmetadataqschinesecodesArray.prototype.flatMapaccessibilityECMAScript 3react animationagentroutinggetawsnodeespreeRxcloudsearchendercompilerPushtypeerrorsnstouch
1.3.76

11 months ago

1.3.75

11 months ago

1.3.74

12 months ago

1.2.74

12 months ago

1.2.73

12 months ago

1.2.72

12 months ago

1.2.71

12 months ago

1.2.70

12 months ago

1.2.69

12 months ago

1.2.68

12 months ago

1.2.67

12 months ago

1.2.66

12 months ago

1.2.65

12 months ago

1.2.64

12 months ago

1.2.63

12 months ago

1.2.62

12 months ago

1.2.61

12 months ago

1.2.60

12 months ago

1.2.59

12 months ago

1.2.58

12 months ago

1.2.57

12 months ago

1.2.56

12 months ago

1.2.55

1 year ago

1.2.54

1 year ago

1.2.53

1 year ago

1.2.52

1 year ago

1.2.51

1 year ago

1.2.50

1 year ago

1.2.49

1 year ago

1.2.48

1 year ago

1.2.47

1 year ago

1.2.46

1 year ago

1.2.45

1 year ago

1.2.44

1 year ago

1.2.43

1 year ago

1.2.42

1 year ago

1.2.41

1 year ago

1.1.41

1 year ago

1.1.40

1 year ago

1.1.39

1 year ago

1.1.38

1 year ago

1.1.37

1 year ago

1.1.36

1 year ago

1.1.35

1 year ago

1.1.34

1 year ago

1.1.33

1 year ago

1.1.32

1 year ago

1.1.31

1 year ago

1.1.30

1 year ago

1.1.29

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.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