Permalink
Browse files

Updated JS lib to 0.9.8.

  • Loading branch information...
1 parent d1ca77a commit 1db9822a8ceb8a87404b42c82c472f24dfd51061 @vseventer vseventer committed Aug 6, 2012
Showing with 34 additions and 2 deletions.
  1. +33 −1 kinvey.js
  2. +1 −1 package.json
View
@@ -349,7 +349,7 @@
*
* @constant
*/
- Kinvey.SDK_VERSION = '0.9.7';
+ Kinvey.SDK_VERSION = '0.9.8';
/**
* Returns current user, or null if not set.
@@ -1758,6 +1758,24 @@
return this;
},
+ /**
+ * Sets a not in condition on the current key.
+ *
+ * @example <code>
+ * // Attribute "field" must have a value starting with foo.
+ * var query = new Kinvey.Query();
+ * query.on('field').regex(/^foo/);
+ * </code>
+ *
+ * @param {object} expected Regular expression.
+ * @throws {Error} On invalid regular expression.
+ * @return {Kinvey.Query} Current instance.
+ */
+ regex: function(expected) {
+ this._set(Kinvey.Query.REGEX, expected);
+ return this;
+ },
+
/**
* Resets all filters.
*
@@ -1987,6 +2005,14 @@
*/
NOT_EQUAL: 22,
+ /**
+ * Regular expression operator. Checks if an element matches the specified
+ * expression.
+ *
+ * @constant
+ */
+ REGEX: 23,
+
// Geoqueries.
/**
* Near sphere operator. Checks if an element is close to the point in
@@ -2157,6 +2183,12 @@
case Kinvey.Query.NOT_EQUAL:
this._set(field, {$ne: value});
break;
+ case Kinvey.Query.REGEX:
+ // Filter through RegExp, this will throw an error on invalid regex.
+ var regex = new RegExp(value);
+ var options = ((regex.global) ? 'g' : '') + ((regex.ignoreCase) ? 'i' : '') + ((regex.multiline) ? 'm' : '');
+ this._set(field, { $regex: regex.source, $options: options });
+ break;
// Geoqueries.
// @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing
View
@@ -2,7 +2,7 @@
"author": "Kinvey, Inc <support@kinvey.com> (http://www.kinvey.com)",
"name": "kinvey",
"description": "Kinvey JavaScript Library for Node.js.",
- "version": "0.9.7",
+ "version": "0.9.8",
"homepage": "http://www.kinvey.com",
"bugs": {
"email": "support@kinvey.com"

0 comments on commit 1db9822

Please sign in to comment.