locutus
Version:
Locutus other languages' standard libraries to JavaScript for fun and educational purposes
14 lines (13 loc) • 527 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.endswith = endswith;
function endswith(suffix, str) {
// discuss at: https://locutus.io/powershell/endswith/
// parity verified: PowerShell 7.4
// original by: Kevin van Zonneveld (https://kvz.io)
// example 1: endswith('World', 'Hello World')
// returns 1: true
// example 2: endswith('Hello', 'Hello World')
// returns 2: false
return String(str).endsWith(String(suffix));
}