From c63241be5acb0d29ce3d4ef4c772d74425d1f9f8 Mon Sep 17 00:00:00 2001 From: Kouhei Sutou Date: Thu, 26 Jul 2012 16:29:23 +0900 Subject: [PATCH] regist -> register "regist" isn't a valid verb. "regsiter" is valid. :-) --- lib/json_matcher.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/json_matcher.js b/lib/json_matcher.js index 0bbc0f5..f85b513 100644 --- a/lib/json_matcher.js +++ b/lib/json_matcher.js @@ -29,35 +29,35 @@ JsonMatcher.prototype.match = function(target, query) { JsonMatcher.advancedQueries = Object.create(null); -JsonMatcher.regist = function(name, matcher) { +JsonMatcher.register = function(name, matcher) { return this.advancedQueries[name] = matcher; }; -JsonMatcher.regist('match', JsonMatcher.prototype.match); +JsonMatcher.register('match', JsonMatcher.prototype.match); -JsonMatcher.regist('in', function(target, query) { +JsonMatcher.register('in', function(target, query) { if (!Array.isArray(query)) { return false; } return query.indexOf(target) >= 0; }); -JsonMatcher.regist('exists', function(target, query) { +JsonMatcher.register('exists', function(target, query) { return (target != null) ^ !query; }); -JsonMatcher.regist('ne', function(target, query) { +JsonMatcher.register('ne', function(target, query) { return target !== query; }); -JsonMatcher.regist('nin', function(target, query) { +JsonMatcher.register('nin', function(target, query) { if (!Array.isArray(query)) { return false; } return !this.in(target, query); }); -JsonMatcher.regist('contains', function(target, query) { +JsonMatcher.register('contains', function(target, query) { var index; if (!target || 'function' !== typeof target.indexOf) { return false; @@ -80,7 +80,7 @@ JsonMatcher.regist('contains', function(target, query) { } }); -JsonMatcher.regist('regexp', function() { +JsonMatcher.register('regexp', function() { var cache; var initializeCache = function() { cache = Object.create(null); @@ -95,7 +95,7 @@ JsonMatcher.regist('regexp', function() { }; }()); -JsonMatcher.regist('or', function(target, query) { +JsonMatcher.register('or', function(target, query) { var i, length; for (i = 0, length = query.length; i < length; i++) { if (this.match(target, query[i])) { @@ -105,7 +105,7 @@ JsonMatcher.regist('or', function(target, query) { return false; }); -JsonMatcher.regist('and', function(target, query) { +JsonMatcher.register('and', function(target, query) { var i, length; for (i = 0, length = query.length; i < length; i++) { if (!this.match(target, query[i])) { @@ -118,7 +118,7 @@ JsonMatcher.regist('and', function(target, query) { /* Example for adding custom matcher. > // 'function' === typeof matcher -> JsonMatcher.regist('custom', matcher); +> JsonMatcher.register('custom', matcher); */ module.exports = JsonMatcher;