replaces EVERY occurrence, matched
// LITERALLY (a "." in the search string is not a wildcard).
// - RegExp searchValue -> must carry the "g" flag, otherwise a
// TypeError is thrown.
// - undefined / null searchValue -> searches for the literal text
// "undefined" / "null".
// - replaceValue honours the $$ $& $` $' $n $ substitution
// patterns, exactly like String.prototype.replace.
//
// Implementation: delegate to String.prototype.replace with a GLOBAL
// regexp. That is the spec's GetSubstitution algorithm, so the "$"
// patterns and the functional-replacement callback arguments
// (match, ...captures, position, string) behave identically.
// -------------------------------------------------------------------
if (typeof String.prototype.replaceAll !== 'function') {
var SYMBOL_MATCH = typeof Symbol !== 'undefined' ? Symbol.match : null;
function isRegExp(value) {
if (value instanceof RegExp) return true;
if (Object.prototype.toString.call(value) === '[object RegExp]') return true;
if (SYMBOL_MATCH) {
try {
return value !== null && value !== undefined &&
typeof value[SYMBOL_MATCH] !== 'undefined';
} catch (err) {
return false;
}
}
return false;
}
// Escapes the regexp syntax characters so the search string is
// matched literally.
function escapeRegExpPattern(str) {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
function replaceAll(searchValue, replaceValue) {
if (this === null || this === undefined) {
throw new TypeError('String.prototype.replaceAll called on null or undefined');
}
var subject = String(this);
var replacement = typeof replaceValue === 'function'
? replaceValue
: (replaceValue === undefined ? 'undefined' : String(replaceValue));
var pattern;
if (searchValue === undefined || searchValue === null) {
pattern = new RegExp(
escapeRegExpPattern(searchValue === undefined ? 'undefined' : 'null'),
'g'
);
} else if (isRegExp(searchValue)) {
var flags = searchValue.flags;
if (typeof flags !== 'string') flags = '';
if (flags.indexOf('g') === -1) {
throw new TypeError(
'String.prototype.replaceAll called with a non-global RegExp argument'
);
}
// RegExpCreate(searchValue, flags): a FRESH regexp with the same
// source and flags, so the caller's lastIndex never matters.
pattern = new RegExp(searchValue.source, flags);
} else {
pattern = new RegExp(escapeRegExpPattern(String(searchValue)), 'g');
}
return subject.replace(pattern, replacement);
}
Object.defineProperty(String.prototype, 'replaceAll', {
value: replaceAll,
writable: true,
enumerable: false,
configurable: true
});
}
// -------------------------------------------------------------------
// Array.prototype.at (ES2022, Chrome 92+)
//
// Used by the bundled Sentry SDK to read the last entry of its
// interaction list. Without it, Chrome 83 throws a TypeError inside
// Sentry's interaction tracking.
// -------------------------------------------------------------------
if (typeof Array.prototype.at !== 'function') {
Object.defineProperty(Array.prototype, 'at', {
value: function at(index) {
var len = this.length >>> 0;
var relativeIndex = Math.trunc(Number(index));
if (relativeIndex !== relativeIndex) relativeIndex = 0; // NaN -> 0
var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
if (k < 0 || k >= len) return undefined;
return this[k];
},
writable: true,
enumerable: false,
configurable: true
});
}
})();
Formation professionnelle à Dakar | ASAFIN
Campus de Dakar · Formation professionnelle au Sénégal
Formation professionnelle à Dakar
ASAFIN Dakar — Grand Yoff (Siège)
Le campus principal et siège de l'ASAFIN, situé à Grand Yoff, accueille chaque année des centaines de jeunes Sénégalais dans un environnement moderne et stimulant. Avec ses ateliers équipés, ses salles de cours connectées et son équipe pédagogique expérimentée, c'est le centre de référence pour la formation professionnelle au Sénégal.