Skip to content

Commit

Permalink
Merge branch 'release/1.9.1' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
MilosPaunovic committed May 30, 2021
2 parents 6aa1e03 + 16f75f3 commit d1c8314
Show file tree
Hide file tree
Showing 5 changed files with 415 additions and 3,223 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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)
[![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)

A simple NPM helper package for generating random values.

Expand Down Expand Up @@ -42,6 +42,9 @@ randomer.STRING.NAMES(howMany); // Defaults to 10
```js
// Random Boolean value
randomer.BOOLEAN.IS();

// Random YES or NO string
randomer.BOOLEAN.YES_NO();
```

#### Colors
Expand Down
31 changes: 30 additions & 1 deletion modules/boolean.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
// Importing dependecies
const { ARGUMENTS } = require('../utils/arguments');

/**
* Returns random generated boolean value
*
* @return {Boolean} Resulting value
*/
const generateBoolean = () => {
// Creating value
const value = Math.round(Math.random() * 1) === 0;

// Returning value
return value;
};

/**
* Returns random generated boolean value
*
Expand All @@ -11,8 +24,24 @@ exports.IS = function () {
ARGUMENTS(arguments, 0, 0, undefined, undefined);

// Creating value
const value = Math.round(Math.random() * 1) === 0;
const value = generateBoolean();

// Making sure value is casted to proper type
return Boolean(value);
};

/**
* Returns random generated YES or NO string
*
* @return {String} Resulting YES or NO value
*/
exports.YES_NO = function () {
// Arguments checking
ARGUMENTS(arguments, 0, 0, undefined, undefined);

// Creating value
const value = generateBoolean() ? 'YES' : 'NO';

// Making sure value is casted to proper type
return String(value);
};
Loading

0 comments on commit d1c8314

Please sign in to comment.