string-to-one-of
v0.0.6
Published
Convert string to one item of given array.
Downloads
3
Maintainers
Readme
string-to-one-of
Convert string to one item of given array
Install
npm install string-to-one-of
Usage
import stringToOneOf from 'string-to-one-of';
const colors = [
'#6468E5',
'#F6D900',
'#EF5350',
'#29C0D7',
'#ADD918',
'#F29140',
'#56D556',
'#FFB100',
'#44D8BB',
'#AB52C7',
'#E864B8',
'#299CD7',
];
stringToOneOf('[email protected]', colors); // #E864B8
stringToOneOf('[email protected]', colors); // #44D8BB
stringToOneOf('[email protected]', colors); // #299CD7