Robert Wozniak (2018-06-27T10:50:07.000Z)
Hi everyone,

ignoreCase - JavaScript proposal

It's a proposal to implement a new function to compare two strings but
without case sensitivity.

The proposal is bringing an important function, which is being used in
Java. Many times in my career I had to compare two strings but ignore case
sensitivity.

I had to convert it first and then I could compare. I'd like developers to
be able to use the function and compare two strings without worrying about
case sensitivity.
<https://github.com/robertjwozniak/ignoreCase#1-syntax>1. Syntax

String.prototype.ignoreCase = function(value, arrayOfStrings) {
    var secondOption = value.toLowerCase() ||
arrayOfStrings.join(',').toLowerCase().split(',');
    var firstOption = this.valueOf().toLowerCase();
    if(typeof secondOption === 'object') {
        for(var i = 0, l = arrayOfStrings.length; i < l; i++) {
            if(firstOption === secondOption[i]) {
                return true;
                break;
            }
        }
    } else {
        if(firstOption === secondOption) {
            return true;
        } else {
            return false;
        }
    }
};

Above code presents *ignoreCase* function and what's happening inside.

The function takes two parameters:

(value, arrayOfStrings)
<https://github.com/robertjwozniak/ignoreCase#11-value-parameter>1.1
"value" parameter

The value parameter is the string which is going to be compared with the
parent string chosen by the developer, for example:

const stringOne = "Matheus";stringOne.ignoreCase("matheus"); // true;

<https://github.com/robertjwozniak/ignoreCase#12-arrayofstrings-paramenter>1.2
"arrayOfStrings" parameter

The "arrayOfStrings" parameter is an array of strings, which are going to
be compared with the parent string chosen by the developer. Once the parent
string equals one of the strings in an array, it will return true and stops
iterating through.

Example:

const stringOne = "Matheus";const manyStrings = ['robert', 'lucas',
'matheus'];stringOne.ignoreCase('', manyStrings) // true;

<https://github.com/robertjwozniak/ignoreCase#2-response>2. Response

The function is going to return true or false. The result depends on
equality between chosen strings.
<https://github.com/robertjwozniak/ignoreCase#3-how-it-works>3. How does it
work?

The function converts all of the strings, which the developer chose to the
lower case. After performing the previous operation, it compares all of
them. If at least one, equals the provided parent string, then the function
returns true.


You can the proposal on my GitHub:
https://github.com/robertjwozniak/ignoreCase


-- 
Regards,
Robert Wozniak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180627/f244dfcd/attachment.html>
wozniakj.robert at gmail.com (2018-06-27T10:57:10.493Z)
ignoreCase - JavaScript proposal

It's a proposal to implement a new function to compare two strings but
without case sensitivity.

The proposal is bringing an important function, which is being used in
Java. Many times in my career I had to compare two strings but ignore case
sensitivity.

I had to convert it first and then I could compare. I'd like developers to
be able to use the function and compare two strings without worrying about
case sensitivity.

1. Syntax

String.prototype.ignoreCase = function(value, arrayOfStrings) {
    var secondOption = value.toLowerCase() ||
arrayOfStrings.join(',').toLowerCase().split(',');
    var firstOption = this.valueOf().toLowerCase();
    if(typeof secondOption === 'object') {
        for(var i = 0, l = arrayOfStrings.length; i < l; i++) {
            if(firstOption === secondOption[i]) {
                return true;
                break;
            }
        }
    } else {
        if(firstOption === secondOption) {
            return true;
        } else {
            return false;
        }
    }
};

Above code presents *ignoreCase* function and what's happening inside.

The function takes two parameters:
(value, arrayOfStrings)

1.1 "value" parameter

The value parameter is the string which is going to be compared with the
parent string is chosen by the developer, for example:

const stringOne = "Matheus";
stringOne.ignoreCase("matheus"); // true;

1.2 "arrayOfStrings" parameter

The "arrayOfStrings" parameter is an array of strings, which are going to
be compared with the parent string chosen by the developer. Once the parent
string equals one of the strings in an array, it will return true and stops
iterating through.

Example:

const stringOne = "Matheus";
const manyStrings = ['robert', 'lucas','matheus'];
stringOne.ignoreCase('', manyStrings) // true;

2. Response

The function is going to return true or false. The result depends on equality between chosen strings.

3. How does it work?

The function converts all of the strings, which the developer chose to the lower case. After performing the previous operation, it compares all of them. If at least one, equals the provided parent string, then the function returns true.


You can the proposal formatted in a proper way on my GitHub:
https://github.com/robertjwozniak/ignoreCase
wozniakj.robert at gmail.com (2018-06-27T10:56:50.180Z)
ignoreCase - JavaScript proposal

It's a proposal to implement a new function to compare two strings but
without case sensitivity.

The proposal is bringing an important function, which is being used in
Java. Many times in my career I had to compare two strings but ignore case
sensitivity.

I had to convert it first and then I could compare. I'd like developers to
be able to use the function and compare two strings without worrying about
case sensitivity.

1. Syntax
<pre>
String.prototype.ignoreCase = function(value, arrayOfStrings) {
    var secondOption = value.toLowerCase() ||
arrayOfStrings.join(',').toLowerCase().split(',');
    var firstOption = this.valueOf().toLowerCase();
    if(typeof secondOption === 'object') {
        for(var i = 0, l = arrayOfStrings.length; i < l; i++) {
            if(firstOption === secondOption[i]) {
                return true;
                break;
            }
        }
    } else {
        if(firstOption === secondOption) {
            return true;
        } else {
            return false;
        }
    }
};
</pre>

Above code presents *ignoreCase* function and what's happening inside.

The function takes two parameters:
(value, arrayOfStrings)

1.1 "value" parameter

The value parameter is the string which is going to be compared with the
parent string is chosen by the developer, for example:

const stringOne = "Matheus";
stringOne.ignoreCase("matheus"); // true;

1.2 "arrayOfStrings" parameter

The "arrayOfStrings" parameter is an array of strings, which are going to
be compared with the parent string chosen by the developer. Once the parent
string equals one of the strings in an array, it will return true and stops
iterating through.

Example:

const stringOne = "Matheus";
const manyStrings = ['robert', 'lucas','matheus'];
stringOne.ignoreCase('', manyStrings) // true;

2. Response

The function is going to return true or false. The result depends on equality between chosen strings.

3. How does it work?

The function converts all of the strings, which the developer chose to the lower case. After performing the previous operation, it compares all of them. If at least one, equals the provided parent string, then the function returns true.


You can the proposal formatted in a proper way on my GitHub:
https://github.com/robertjwozniak/ignoreCase
wozniakj.robert at gmail.com (2018-06-27T10:56:32.423Z)
ignoreCase - JavaScript proposal

It's a proposal to implement a new function to compare two strings but
without case sensitivity.

The proposal is bringing an important function, which is being used in
Java. Many times in my career I had to compare two strings but ignore case
sensitivity.

I had to convert it first and then I could compare. I'd like developers to
be able to use the function and compare two strings without worrying about
case sensitivity.

1. Syntax
<code>
String.prototype.ignoreCase = function(value, arrayOfStrings) {
    var secondOption = value.toLowerCase() ||
arrayOfStrings.join(',').toLowerCase().split(',');
    var firstOption = this.valueOf().toLowerCase();
    if(typeof secondOption === 'object') {
        for(var i = 0, l = arrayOfStrings.length; i < l; i++) {
            if(firstOption === secondOption[i]) {
                return true;
                break;
            }
        }
    } else {
        if(firstOption === secondOption) {
            return true;
        } else {
            return false;
        }
    }
};
</code>

Above code presents *ignoreCase* function and what's happening inside.

The function takes two parameters:
(value, arrayOfStrings)

1.1 "value" parameter

The value parameter is the string which is going to be compared with the
parent string is chosen by the developer, for example:

const stringOne = "Matheus";
stringOne.ignoreCase("matheus"); // true;

1.2 "arrayOfStrings" parameter

The "arrayOfStrings" parameter is an array of strings, which are going to
be compared with the parent string chosen by the developer. Once the parent
string equals one of the strings in an array, it will return true and stops
iterating through.

Example:

const stringOne = "Matheus";
const manyStrings = ['robert', 'lucas','matheus'];
stringOne.ignoreCase('', manyStrings) // true;

2. Response

The function is going to return true or false. The result depends on equality between chosen strings.

3. How does it work?

The function converts all of the strings, which the developer chose to the lower case. After performing the previous operation, it compares all of them. If at least one, equals the provided parent string, then the function returns true.


You can the proposal formatted in a proper way on my GitHub:
https://github.com/robertjwozniak/ignoreCase
wozniakj.robert at gmail.com (2018-06-27T10:55:39.334Z)
ignoreCase - JavaScript proposal

It's a proposal to implement a new function to compare two strings but
without case sensitivity.

The proposal is bringing an important function, which is being used in
Java. Many times in my career I had to compare two strings but ignore case
sensitivity.

I had to convert it first and then I could compare. I'd like developers to
be able to use the function and compare two strings without worrying about
case sensitivity.

1. Syntax

String.prototype.ignoreCase = function(value, arrayOfStrings) {
    var secondOption = value.toLowerCase() ||
arrayOfStrings.join(',').toLowerCase().split(',');
    var firstOption = this.valueOf().toLowerCase();
    if(typeof secondOption === 'object') {
        for(var i = 0, l = arrayOfStrings.length; i < l; i++) {
            if(firstOption === secondOption[i]) {
                return true;
                break;
            }
        }
    } else {
        if(firstOption === secondOption) {
            return true;
        } else {
            return false;
        }
    }
};

Above code presents *ignoreCase* function and what's happening inside.

The function takes two parameters:
(value, arrayOfStrings)

1.1 "value" parameter

The value parameter is the string which is going to be compared with the
parent string is chosen by the developer, for example:

const stringOne = "Matheus";
stringOne.ignoreCase("matheus"); // true;

1.2 "arrayOfStrings" parameter

The "arrayOfStrings" parameter is an array of strings, which are going to
be compared with the parent string chosen by the developer. Once the parent
string equals one of the strings in an array, it will return true and stops
iterating through.

Example:

const stringOne = "Matheus";
const manyStrings = ['robert', 'lucas','matheus'];
stringOne.ignoreCase('', manyStrings) // true;

2. Response

The function is going to return true or false. The result depends on equality between chosen strings.

3. How does it work?

The function converts all of the strings, which the developer chose to the lower case. After performing the previous operation, it compares all of them. If at least one, equals the provided parent string, then the function returns true.


You can the proposal formatted in a proper way on my GitHub:
https://github.com/robertjwozniak/ignoreCase
wozniakj.robert at gmail.com (2018-06-27T10:55:05.747Z)
ignoreCase - JavaScript proposal

It's a proposal to implement a new function to compare two strings but
without case sensitivity.

The proposal is bringing an important function, which is being used in
Java. Many times in my career I had to compare two strings but ignore case
sensitivity.

I had to convert it first and then I could compare. I'd like developers to
be able to use the function and compare two strings without worrying about
case sensitivity.

1. Syntax

String.prototype.ignoreCase = function(value, arrayOfStrings) {
    var secondOption = value.toLowerCase() ||
arrayOfStrings.join(',').toLowerCase().split(',');
    var firstOption = this.valueOf().toLowerCase();
    if(typeof secondOption === 'object') {
        for(var i = 0, l = arrayOfStrings.length; i < l; i++) {
            if(firstOption === secondOption[i]) {
                return true;
                break;
            }
        }
    } else {
        if(firstOption === secondOption) {
            return true;
        } else {
            return false;
        }
    }
};

Above code presents *ignoreCase* function and what's happening inside.

The function takes two parameters:
(value, arrayOfStrings)

1.1 "value" parameter

The value parameter is the string which is going to be compared with the
parent string is chosen by the developer, for example:

const stringOne = "Matheus";
stringOne.ignoreCase("matheus"); // true;

1.2 "arrayOfStrings" parameter

The "arrayOfStrings" parameter is an array of strings, which are going to
be compared with the parent string chosen by the developer. Once the parent
string equals one of the strings in an array, it will return true and stops
iterating through.

Example:

const stringOne = "Matheus";
const manyStrings = ['robert', 'lucas','matheus'];
stringOne.ignoreCase('', manyStrings) // true;

2. Response

The function is going to return true or false. The result depends on equality between chosen strings.

3. How does it work?

The function converts all of the strings, which the developer chose to the lower case. After performing the previous operation, it compares all of them. If at least one, equals the provided parent string, then the function returns true.


You can the proposal on my GitHub:
https://github.com/robertjwozniak/ignoreCase