From b94145ff904315c48781f958f54fae1428ef60e6 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 23 Oct 2012 10:28:49 -0700 Subject: Clean up report, save transactions as JSON --- js/searchjs.js | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 js/searchjs.js (limited to 'js/searchjs.js') diff --git a/js/searchjs.js b/js/searchjs.js new file mode 100644 index 00000000..d77f46e9 --- /dev/null +++ b/js/searchjs.js @@ -0,0 +1,107 @@ +/*jslint node:true,nomen:false */ +(function(exports){ + var matchObj, matchArray, singleMatch; + + singleMatch = function(field,s) { + var oneMatch = false, t, re, i, j; + // for numbers, exact match; for strings, ignore-case match; for anything else, no match + t = typeof(field); + if (field === null) { + oneMatch = s === null; + } else if (field === undefined) { + oneMatch = false; + } else if (t === "number") { + oneMatch = field === s; + } else if (t === "string") { + re = new RegExp(s,"i"); + oneMatch = field && field.match(re) !== null; + } else if (typeof(field.length) !== "undefined") { + // array, so go through each + for (j=0;j 0) { + for (i=0;i