From 8bc0aad4edd7e9d033870594f833b24af6a108e1 Mon Sep 17 00:00:00 2001
From: Scott Worley <scottworley@scottworley.com>
Date: Fri, 28 Feb 2014 09:32:51 -0800
Subject: [PATCH] I miss ${foo%bar}

---
 picsorter.js | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/picsorter.js b/picsorter.js
index 70cd236..2f9df0c 100644
--- a/picsorter.js
+++ b/picsorter.js
@@ -16,6 +16,16 @@ var exposure = 20;
 var zoom = "sm/";
 var input_index = -1;
 
+function endsWith(str, suffix) {
+  return str.indexOf(suffix, str.length - suffix.length) !== -1;
+}
+
+function stripFromEnd(str, suffix) {
+  if (endsWith(str, suffix)) {
+    return str.substr(0, str.length - suffix.length);
+  }
+  return str;
+}
 
 function setpic() {
   if ("exposure" in picinfo[files[input_index]]) {
-- 
2.47.2