Skip to content

Instantly share code, notes, and snippets.

@ppbntl19
Created April 17, 2015 06:33
Show Gist options
  • Save ppbntl19/af2f20d4f4b785c3299d to your computer and use it in GitHub Desktop.
Save ppbntl19/af2f20d4f4b785c3299d to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/bihanekiva
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
var old = ('Iseeit Inc');
var str2 = ('iseeiT');
var str3 =('isEEit Inc');
var str4 =('isEEitNEW Inc');
var str5 =('isEEit Aus');
console.log(determineConflict(old,str2));
console.log(determineConflict(old,str3));
console.log(determineConflict(old,str4));
console.log(determineConflict(old,str5));
function determineConflict(o,n){
if(checkExactMatch(o,n)){
return {conflict: true, partialMatch: false};
}
if(checkPartialMatch(o,n)){
return {conflict: true, partialMatch: true};
}
return {conflict: false};
}
function checkPartialMatch(o,n){
var result = false ;
o = o.split(' ');
n = n.split(' ');
if(o[0].toLowerCase() == n[0].toLowerCase()){
result = true;
}
return result;
}
function checkExactMatch(o,n){
var result = false;
if(o.toLowerCase() == n.toLowerCase()){
result = true;
}
return result;
}
</script>
<script id="jsbin-source-javascript" type="text/javascript">var old = ('Iseeit Inc');
var str2 = ('iseeiT');
var str3 =('isEEit Inc');
var str4 =('isEEitNEW Inc');
var str5 =('isEEit Aus');
console.log(determineConflict(old,str2));
console.log(determineConflict(old,str3));
console.log(determineConflict(old,str4));
console.log(determineConflict(old,str5));
function determineConflict(o,n){
if(checkExactMatch(o,n)){
return {conflict: true, partialMatch: false};
}
if(checkPartialMatch(o,n)){
return {conflict: true, partialMatch: true};
}
return {conflict: false};
}
function checkPartialMatch(o,n){
var result = false ;
o = o.split(' ');
n = n.split(' ');
if(o[0].toLowerCase() == n[0].toLowerCase()){
result = true;
}
return result;
}
function checkExactMatch(o,n){
var result = false;
if(o.toLowerCase() == n.toLowerCase()){
result = true;
}
return result;
}
</script></body>
</html>
var old = ('Iseeit Inc');
var str2 = ('iseeiT');
var str3 =('isEEit Inc');
var str4 =('isEEitNEW Inc');
var str5 =('isEEit Aus');
console.log(determineConflict(old,str2));
console.log(determineConflict(old,str3));
console.log(determineConflict(old,str4));
console.log(determineConflict(old,str5));
function determineConflict(o,n){
if(checkExactMatch(o,n)){
return {conflict: true, partialMatch: false};
}
if(checkPartialMatch(o,n)){
return {conflict: true, partialMatch: true};
}
return {conflict: false};
}
function checkPartialMatch(o,n){
var result = false ;
o = o.split(' ');
n = n.split(' ');
if(o[0].toLowerCase() == n[0].toLowerCase()){
result = true;
}
return result;
}
function checkExactMatch(o,n){
var result = false;
if(o.toLowerCase() == n.toLowerCase()){
result = true;
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment