String.cooked
Less than 1 minute
String.cooked
Module
Types
interface StringConstructor {
cooked(template: Array<string>, ...substitutions: Array<string>): string;
}
Entry points
core-js/proposals/string-cooked
core-js(-pure)/full/string/cooked
Example
function safePath(strings, ...subs) {
return String.cooked(strings, ...subs.map((sub) => encodeURIComponent(sub)));
}
let id = "spottie?";
safePath`/cats/${id}`; // => /cats/spottie%3F