update description for isPrimitive, add 2 tests, isPrimitive & isPrime

This commit is contained in:
Stefan Feješ
2018-01-10 15:19:09 +01:00
parent 3c8840a2d3
commit 55699201a4
3 changed files with 10 additions and 1 deletions

View File

@ -1,6 +1,6 @@
### isPrimitive ### isPrimitive
Returns a boolean determining if the supplied value is primitive or not. Returns a boolean determining if the passed value is primitive or not.
Use `Array.includes()` on an array of type strings which are not primitive, Use `Array.includes()` on an array of type strings which are not primitive,
supplying the type using `typeof`. supplying the type using `typeof`.

View File

@ -5,6 +5,7 @@ test('Testing isPrime', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof isPrime === 'function', 'isPrime is a Function'); t.true(typeof isPrime === 'function', 'isPrime is a Function');
t.equal(isPrime(11), true, "passed number is a prime");
//t.deepEqual(isPrime(args..), 'Expected'); //t.deepEqual(isPrime(args..), 'Expected');
//t.equal(isPrime(args..), 'Expected'); //t.equal(isPrime(args..), 'Expected');
//t.false(isPrime(args..), 'Expected'); //t.false(isPrime(args..), 'Expected');

View File

@ -5,6 +5,14 @@ test('Testing isPrimitive', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof isPrimitive === 'function', 'isPrimitive is a Function'); t.true(typeof isPrimitive === 'function', 'isPrimitive is a Function');
t.equal(isPrimitive(null), true, "passed value is primitive");
t.equal(isPrimitive(50), true, "passed value is primitive");
t.equal(isPrimitive('Hello'), true, "passed value is primitive");
t.equal(isPrimitive(false), true, "passed value is primitive");
t.equal(isPrimitive(Symbol()), true, "passed value is primitive");
t.equal(isPrimitive([]), false, "passed value is primitive");
//t.deepEqual(isPrimitive(args..), 'Expected'); //t.deepEqual(isPrimitive(args..), 'Expected');
//t.equal(isPrimitive(args..), 'Expected'); //t.equal(isPrimitive(args..), 'Expected');
//t.false(isPrimitive(args..), 'Expected'); //t.false(isPrimitive(args..), 'Expected');