Skip to content

Npm package thats compare two values with various paramaters.

License

Notifications You must be signed in to change notification settings

RodrigoCamposD/have-matching

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

have-matching

Compare two values with some options.

NPM

Node Version NPM Version NPM Downloads

Install

npm install have-matching

Usage

const haveMatching = require("have-matching");
haveMatching("t5est", "tSet5")); // true

Tests

npm test

Examples

haveMatching("test", "tSet5")); // false
haveMatching("t5est", "tSet5")); // true
haveMatching(889, "988")); // true
haveMatching("test", "tSet/8", { onlyLetters: true })); // true
haveMatching("test", "tSet8", { onlyNumbers: true })); // false
haveMatching("abc889", "98xyz8", { onlyNumbers: true })); // true
haveMatching("test", "tesT", { caseSensitive: true })); // false
haveMatching("test8", "tSe8t//.", {
    onlyNumbers: true,
    onlyLetters: true,
  })
); // true
haveMatching("test", ["te", "st"])); // false
haveMatching("test", ["tSet", "st"])); // true
haveMatching(8, ["88", "test"])); // false
haveMatching("test", "Test", { orderMatter: true })); // true

haveMatching("test8", "test8", {
    orderMatter: true,
    onlyNumbers: true,
    caseSensitive: true,
    onlyLetters: true,
  })
); // true