mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-06 22:57:02 +02:00
22 lines
604 B
JavaScript
22 lines
604 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
// By Mozilla Contributors licensed under CC-BY-SA 2.5 (http://creativecommons.org/licenses/by-sa/2.5/)
|
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes#Polyfill
|
|
if (!String.prototype.includes) {
|
|
String.prototype.includes = function (search, start) {
|
|
'use strict';
|
|
if (typeof start !== 'number') {
|
|
start = 0;
|
|
}
|
|
|
|
if (start + search.length > this.length) {
|
|
return false;
|
|
} else {
|
|
return this.indexOf(search, start) !== -1;
|
|
}
|
|
};
|
|
}
|