From 765ef92d69f089ae6eeb89befacbe556a53fee8e Mon Sep 17 00:00:00 2001 From: Erin Rivas Date: Tue, 22 Feb 2022 22:08:53 -0600 Subject: [PATCH] updating tests, readme, and changelog --- changelog.md | 11 ++++++++++- readme.md | 29 ++++++++++++++++++++++------- test/main/integer.test.js | 2 +- test/main/string.test.js | 2 +- test/main/uuid.test.js | 2 +- test/main/words.test.js | 2 +- 6 files changed, 36 insertions(+), 12 deletions(-) diff --git a/changelog.md b/changelog.md index 633516d..2e2c547 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Major Releases: +### [v2.0.0] - 2022 02 22 +#### Added +- New random word generator: + - `randomEnglish()` Generates text block with specified number of random English words. +#### Changed +- Introducing Types! We have converted to Typescript, and it is good. +- Added input sanitization to several functions that were missing it. + ### [v1.0.0] - 2019 06 23 #### Added - Two random string functions: @@ -81,7 +89,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 -[Unreleased]: https://github.com/karnthis/make-random/compare/v1.3.0...dev +[Unreleased]: https://github.com/karnthis/make-random/compare/v2.0.0...dev +[v2.0.0]: https://github.com/karnthis/make-random/compare/v1.3.0...2.0.0 [v1.3.0]: https://github.com/karnthis/make-random/compare/v1.2.2...v1.3.0 [v1.2.2]: https://github.com/karnthis/make-random/compare/v1.2.0...v1.2.2 [v1.2.0]: https://github.com/karnthis/make-random/compare/v1.1.0...v1.2.0 diff --git a/readme.md b/readme.md index dd5d261..8c0d9c8 100644 --- a/readme.md +++ b/readme.md @@ -25,6 +25,7 @@ npm install make-random - [randomString()](#randomString) - [randomCaseString()](#randomCaseString) - [randomLatin()](#randomLatin) +- [randomEnglish()](#randomEnglish) - [randomUUID()](#randomUUID) __All ranges are inclusive of the passed value(s)__ @@ -194,6 +195,26 @@ randomLatin('20') .then(resp => console.log(resp)) ``` +### randomEnglish() + +The `randomEnglish()` method accepts an optional integer or integer-like argument. It returns a string with the specified number of random latin words. If no argument is given, method defaults to 5 words. All words start with E or R. + +```javascript +const { randomEnglish } = require('make-random') + +// Return string with 5 random words +randomEnglish() +.then(resp => console.log(resp)) + +// Return string with 12 random words +randomEnglish(12) +.then(resp => console.log(resp)) + +// Accept integer or integer-like string +randomEnglish('20') +.then(resp => console.log(resp)) +``` + ### randomUUID() The `randomUUID()` method generates v4-compliant CSPRNG UUID @@ -207,19 +228,13 @@ randomUUID() .then(resp => console.log(resp)) ``` -## Deprecated - -### Make-Random-Legacy - -The old methods `makeRandom.ceil()` and `makeRandom.floor()` have been discontined and removed. If continued use is needed and the new `random()` will not meet your needs, please switch to [make-random-legacy](https://github.com/karnthis/make-random-legacy) or consider submitting a feature request or PR. - ## License The MIT License (MIT) Copyright (c) 2016 John Foderaro -Copyright (c) 2019 Erin Rivas +Copyright (c) 2019-2022 Erin Rivas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/test/main/integer.test.js b/test/main/integer.test.js index 4902f8b..3ea8b90 100644 --- a/test/main/integer.test.js +++ b/test/main/integer.test.js @@ -1,7 +1,7 @@ 'use strict'; const { expect } = require('chai'); -const { random, randomInRange } = require('../../src/libs'); +const { random, randomInRange } = require('../../dist/libs'); describe('random()', () => { it(`should be a function`, ()=> { diff --git a/test/main/string.test.js b/test/main/string.test.js index 8e21b01..bcbad6a 100644 --- a/test/main/string.test.js +++ b/test/main/string.test.js @@ -1,7 +1,7 @@ 'use strict'; const { expect } = require('chai'); -const { randomAZString, randomString } = require('../../src/libs'); +const { randomAZString, randomString } = require('../../dist/libs'); describe('randomAZString()', () => { it(`should be a function`, ()=> { diff --git a/test/main/uuid.test.js b/test/main/uuid.test.js index 31dbcdf..386b96b 100644 --- a/test/main/uuid.test.js +++ b/test/main/uuid.test.js @@ -3,7 +3,7 @@ const chai = require('chai'); const { expect } = chai; chai.use(require('chai-uuid')); -const { randomUUID } = require('../../src/libs'); +const { randomUUID } = require('../../dist/libs'); describe('randomUUID()', () => { it(`should be a function`, ()=> { diff --git a/test/main/words.test.js b/test/main/words.test.js index b557e57..fdae328 100644 --- a/test/main/words.test.js +++ b/test/main/words.test.js @@ -1,7 +1,7 @@ 'use strict'; const { expect } = require('chai'); -const { randomLatin } = require('../../src/libs'); +const { randomLatin } = require('../../dist/libs'); describe('randomLatin()', () => { it(`should be a function`, ()=> {