Skip to content

Commit cad7cda

Browse files
committed
Provide indexOf emulation
1 parent ae4baec commit cad7cda

File tree

1 file changed

+7
-0
lines changed
  • src/JsPhpize/Compiler/Helpers

1 file changed

+7
-0
lines changed

src/JsPhpize/Compiler/Helpers/Dot.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ function ($base) {
2424
return substr($base, $pos, 1);
2525
};
2626
}
27+
if ($key === 'indexOf') {
28+
return function ($needle) use ($base) {
29+
$pos = strpos($base, $needle);
30+
31+
return $pos === false ? -1 : $pos;
32+
};
33+
}
2734
if ($key === 'toUpperCase') {
2835
return function () use ($base) {
2936
return strtoupper($base);

0 commit comments

Comments
 (0)