Skip to content

Commit d1c8314

Browse files
committed
Merge branch 'release/1.9.1' into main
2 parents 6aa1e03 + 16f75f3 commit d1c8314

File tree

5 files changed

+415
-3223
lines changed

5 files changed

+415
-3223
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# complete-randomer
22

3-
[![Testing](https://github.com/MilosPaunovic/complete-randomer/actions/workflows/testing.yml/badge.svg)](https://github.com/MilosPaunovic/complete-randomer/actions/workflows/testing.yml) [![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://github.com/MilosPaunovic/complete-randomer/blob/develop/LICENSE)
3+
[![npm version](https://badge.fury.io/js/complete-randomer.svg)](https://badge.fury.io/js/complete-randomer) [![Testing](https://github.com/MilosPaunovic/complete-randomer/actions/workflows/testing.yml/badge.svg)](https://github.com/MilosPaunovic/complete-randomer/actions/workflows/testing.yml) [![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://github.com/MilosPaunovic/complete-randomer/blob/develop/LICENSE)
44

55
A simple NPM helper package for generating random values.
66

@@ -42,6 +42,9 @@ randomer.STRING.NAMES(howMany); // Defaults to 10
4242
```js
4343
// Random Boolean value
4444
randomer.BOOLEAN.IS();
45+
46+
// Random YES or NO string
47+
randomer.BOOLEAN.YES_NO();
4548
```
4649

4750
#### Colors

modules/boolean.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
// Importing dependecies
22
const { ARGUMENTS } = require('../utils/arguments');
33

4+
/**
5+
* Returns random generated boolean value
6+
*
7+
* @return {Boolean} Resulting value
8+
*/
9+
const generateBoolean = () => {
10+
// Creating value
11+
const value = Math.round(Math.random() * 1) === 0;
12+
13+
// Returning value
14+
return value;
15+
};
16+
417
/**
518
* Returns random generated boolean value
619
*
@@ -11,8 +24,24 @@ exports.IS = function () {
1124
ARGUMENTS(arguments, 0, 0, undefined, undefined);
1225

1326
// Creating value
14-
const value = Math.round(Math.random() * 1) === 0;
27+
const value = generateBoolean();
1528

1629
// Making sure value is casted to proper type
1730
return Boolean(value);
1831
};
32+
33+
/**
34+
* Returns random generated YES or NO string
35+
*
36+
* @return {String} Resulting YES or NO value
37+
*/
38+
exports.YES_NO = function () {
39+
// Arguments checking
40+
ARGUMENTS(arguments, 0, 0, undefined, undefined);
41+
42+
// Creating value
43+
const value = generateBoolean() ? 'YES' : 'NO';
44+
45+
// Making sure value is casted to proper type
46+
return String(value);
47+
};

0 commit comments

Comments
 (0)