1.3.11 • Published 5 years ago
conloy v1.3.11
conloy
A lightweight solution to writing if return statements.
Installation
npm i conloy
yarn add conloy
Then...
const convert = require('conloy');
convert(x, y, input, caseSensitivity, crossConversion);
Options
This function supports 5 parameters, 2 of which are optional:
- x - The value that will be converted (Supports arrays)
- y - The value that x will be converted to (Supports arrays)
- input - Where to get x from
- caseSensitivity - boolean | is it case-sensitive (optional, defaults to false)
- crossConversion boolean | does y convert to x (optional, defaults to false)
Example
Without conloy
if (input === 0) {
return 'zero';
} else if (input === 1) {
return 'one';
} else if (input === 2) {
return 'two';
} else if (input === 3) {
return 'three';
} else if (input === 4) {
return 'four';
} else if (input === 5) {
return 'five';
} else if (input === 6) {
return 'six';
} else if (input === 7) {
return 'seven';
} else if (input === 8) {
return 'eight';
} else if (input === 9) {
return 'nine';
}
With conloy
const convert = require('conloy');
const numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
const text = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
convert(numbers, text, input);
1.3.11
5 years ago
1.3.10
5 years ago
1.3.9
5 years ago
1.3.8
5 years ago
1.3.7
5 years ago
1.3.6
5 years ago
1.3.5
5 years ago
1.3.4
5 years ago
1.3.3
5 years ago
1.3.2
5 years ago
1.3.1
5 years ago
1.3.0
5 years ago
1.2.7
5 years ago
1.2.6
5 years ago
1.2.5
5 years ago
1.2.4
5 years ago
1.2.3
5 years ago
1.2.2
5 years ago
1.2.1
5 years ago
1.2.0
5 years ago
1.1.9
5 years ago
1.1.8
5 years ago
1.1.7
5 years ago
1.1.6
5 years ago
1.1.5
5 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.1.4
5 years ago
1.1.3
5 years ago
1.1.2
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.0
5 years ago