From b0e10d15b5c5dba7927be2bf5f180183bfdcf79f Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Wed, 14 Oct 2015 14:53:53 +0000 Subject: [PATCH] secure redirect --- node_modules/c9/string.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/node_modules/c9/string.js b/node_modules/c9/string.js index 5e3714ce..2a28f65c 100644 --- a/node_modules/c9/string.js +++ b/node_modules/c9/string.js @@ -43,5 +43,14 @@ exports.repeat = function(str, times) { exports.count = function(str, substr){ return str.split(substr).length - 1; }; + +exports.endsWith = function(subjectString, searchString, position) { + if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { + position = subjectString.length; + } + position -= searchString.length; + var lastIndex = subjectString.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; +}; }); \ No newline at end of file