From 1a010d1945b117f8b07c9d35193148ac5313f2f1 Mon Sep 17 00:00:00 2001 From: Ishai Date: Sun, 17 Aug 2014 16:08:35 +0300 Subject: [PATCH] fix endswith operand --- package.json | 2 +- resource.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index ff1a86a..c2658d6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jest", "description": "JavaScriptational State Transfer. JS restful API layer with Mongoose based resources. Inspired by python Tastypie", - "version": "0.1.37", + "version": "0.1.38", "author": "Ishai Jaffe ", "contributors": [ { diff --git a/resource.js b/resource.js index be580c3..69e5c4b 100644 --- a/resource.js +++ b/resource.js @@ -703,7 +703,7 @@ var Resource = module.exports = Class.extend({ delete filters[field]; } if(operand == 'endswith') { - filters[field.replace('__endswith','')] = new RegExp(this.escape_regex(filters[field] + '$')); + filters[field.replace('__endswith','')] = new RegExp(this.escape_regex(filters[field]) + '$'); delete filters[field]; } if(operand == 'iexact') { @@ -719,7 +719,7 @@ var Resource = module.exports = Class.extend({ delete filters[field]; } if(operand == 'iendswith') { - filters[field.replace('__iendswith','')] = new RegExp(this.escape_regex(filters[field] + '$'),'i'); + filters[field.replace('__iendswith','')] = new RegExp(this.escape_regex(filters[field]) + '$','i'); delete filters[field]; } if (field == 'or')