UNPKG

locutus

Version:

Locutus other languages' standard libraries to JavaScript for fun and educational purposes

15 lines (14 loc) 587 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.strchr = strchr; const strstr_ts_1 = require("../strings/strstr.js"); function strchr(haystack, needle, bool) { // discuss at: https://locutus.io/php/strchr/ // parity verified: PHP 8.3 // original by: Philip Peterson // example 1: strchr('Kevin van Zonneveld', 'van') // returns 1: 'van Zonneveld' // example 2: strchr('Kevin van Zonneveld', 'van', true) // returns 2: 'Kevin ' return (0, strstr_ts_1.strstr)(haystack, needle, bool); }