locutusjs / locutus

Bringing stdlibs of other programming languages to JavaScript for educational purposes

Home Page:https://locutus.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

array_search in unstrict mode fail

sirio3mil opened this issue · comments

If you try array_search('3', {a: 3, b: 5}) this will return false instead a.

The error come from this line

if((strict && haystack[key] === needle) || (!strict && haystack[key] === needle)){

It should be like

if((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)){

Whithout === if !strict.

Regards

Think you're right! Would you like to submit a pr for this?

On Fri, Nov 4, 2016 at 2:05 PM, Reynier de la Rosa <notifications@github.com

wrote:

If you try array_search('3', {a: 3, b: 5}) this will return false instead
a.

The error come from this line

if((strict && haystack[key] === needle) || (!strict && haystack[key] ===
needle)){

It should be like

if((strict && haystack[key] === needle) || (!strict && haystack[key] ==
needle)){

Whithout === if !strict.

Regards


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#311, or mute the thread
https://github.com/notifications/unsubscribe-auth/ASRpqkGVFAzezyQM8poEKmFaJu1VAk8uks5q6y2mgaJpZM4Kpg8I
.

Kevin van Zonneveld (kvz.io)
Co-Founder, Transloadit (transloadit.com)

Ok I wil try, I have another for nl2br function :-)