Baseline Widely available
Symbol.search
ã¯éçãã¼ã¿ããããã£ã§ãã¦ã§ã«ãã¦ã³ã·ã³ãã«ã§ãã Symbol.search
ã表ãã¾ããString.prototype.search()
ã¡ã½ããã¯ç¬¬ä¸å¼æ°ãããæååå
ã§ç¾å¨ã®ãªãã¸ã§ã¯ãã«ä¸è´ããå ´æãè¿ãã¡ã½ãããããã®ã·ã³ãã«ã§æ¢ãã¾ãã
詳ããã¯ãRegExp.prototype[Symbol.search]()
㨠String.prototype.search()
ãåç
§ãã¦ãã ããã
class Search1 {
constructor(value) {
this.value = value;
}
[Symbol.search](string) {
return string.indexOf(this.value);
}
}
console.log("foobar".search(new Search1("bar")));
// Expected output: 3
å¤
ã¦ã§ã«ãã¦ã³ã·ã³ãã« Symbol.search
ã§ãã
class caseInsensitiveSearch {
constructor(value) {
this.value = value.toLowerCase();
}
[Symbol.search](string) {
return string.toLowerCase().indexOf(this.value);
}
}
console.log("foobar".search(new caseInsensitiveSearch("BaR"))); // 3
仿§æ¸ ãã©ã¦ã¶ã¼ã®äºææ§ é¢é£æ
å ±
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4