This commit is contained in:
Rohit Tanwar
2018-02-26 15:06:47 +05:30
parent e2d06d4ca8
commit d093cd0d43
5 changed files with 128 additions and 93 deletions

View File

@ -0,0 +1,5 @@
const isSimilar = (pattern, str) =>
[...str].reduce(
(matchIndex, char) => char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase() ? matchIndex + 1 : matchIndex, 0
) === pattern.length ? true : false;
module.exports = isSimilar;

View File

@ -0,0 +1,13 @@
const test = require('tape');
const isSimilar = require('./isSimilar.js');
test('Testing isSimilar', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof isSimilar === 'function', 'isSimilar is a Function');
//t.deepEqual(isSimilar(args..), 'Expected');
//t.equal(isSimilar(args..), 'Expected');
//t.false(isSimilar(args..), 'Expected');
//t.throws(isSimilar(args..), 'Expected');
t.end();
});