MCPcopy Create free account
hub / github.com/ember-learn/ember-api-docs / initialize

Function initialize

app/initializers/add-string-includes-polyfill.js:1–16  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1export function initialize() {
2 // Source: https://developer.mozilla.org/cs/docs/Web/JavaScript/Reference/Global_Objects/String/includes#Polyfill
3 if (!String.prototype.includes) {
4 String.prototype.includes = function (search, start) {
5 'use strict';
6 if (typeof start !== 'number') {
7 start = 0;
8 }
9 if (start + search.length > this.length) {
10 return false;
11 } else {
12 return this.indexOf(search, start) !== -1;
13 }
14 };
15 }
16}
17
18export default {
19 name: 'add-string-includes-polyfill',

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected