Function that returns true when the given number equals to eleven.
When you have to create a function that check whether the value really equals to eleven, there is a big chance to end up with code like this:
const check = val => Number(val) === 11;
Seems good, right? But this code doesn't really work the way you expect it to work. Let's see an example:
check([11]); // true
See? That simple oneliner isn't really a universal solution. And this is where our package comes to play.
const { isEleven } = require('is-eleven');
isEleven([11]); // false, yay!
With is-eleven package, you can forget about javascript's unexpected behavior and concentrate on the logic in your code instead of type checking.
# npm
npm i --save is-eleven
# yarn
yarn add is-eleven
const { isEleven } = require('is-eleven');
// or
import { isEleven } from 'is-eleven'
/* true */
isEleven(11);
isEleven(0b1011);
isEleven('11');
isEleven(' 11');
/* false */
isEleven(12);
isEleven([11]);
isEleven(0x11);
isEleven('12');
isEleven('eleven');
isEleven('foo');
isEleven('11foo');