Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Lightweight util for generating random sentences, paragraphs and articles in English. Inspired by Sentencer and metaphorpsum.com.
Node.js
npm i txtgen
CDN
Also supports ES6 Module, CommonJS, AMD and UMD style.
const txtgen = require('txtgen');
const sentence = txtgen.sentence();
console.log(sentence);
const paragraph = txtgen.paragraph();
console.log(paragraph);
const article = txtgen.article();
console.log(article);
As their name means, we have 4 groups of methods:
sentence()
, paragraph()
, article()
: generate text by given grammatical unitaddNouns()
, addAdjectives()
, addTemplates()
: add more samples to current sample setsetNouns()
, setAdjectives()
, setTemplates()
: replace current sample set with new onesgetNouns()
, getAdjectives()
, getTemplates()
: get current sample setThe set*
and get*
methods were added since v2.2.3 to help you customize your sample data.
If you want to add more kinds of sentence, just use .addTemplates()
method. It expects a list of sentence templates.
Each of sentence template is an English sentence, with the placeholders that can be replaced with any alternative word.
For example:
import {
addTemplates
} from 'txtgen';
let 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:
git clone https://github.com/ndaidong/txtgen.git
cd txtgen
npm install
npm test
The MIT License (MIT)
FAQs
Util for generating random sentences, paragraphs and articles in English
The npm package txtgen receives a total of 3,613 weekly downloads. As such, txtgen popularity was classified as popular.
We found that txtgen demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.