Kouhei Sutou
null+****@clear*****
Mon Mar 24 23:58:14 JST 2014
Kouhei Sutou 2014-03-24 23:58:14 +0900 (Mon, 24 Mar 2014) New Revision: 3069db6327c89a09e9c17e00ff18f631ce38d666 https://github.com/droonga/express-droonga/commit/3069db6327c89a09e9c17e00ff18f631ce38d666 Message: Simplify if (typeof XXX == 'string') -> if (XXX) Modified files: lib/adapter/api/rest-request-builder.js Modified: lib/adapter/api/rest-request-builder.js (+9 -9) =================================================================== --- lib/adapter/api/rest-request-builder.js 2014-03-24 23:52:46 +0900 (758e73a) +++ lib/adapter/api/rest-request-builder.js 2014-03-24 23:58:14 +0900 (be5bfa6) @@ -47,21 +47,21 @@ function searchRequestBuilder(request) { } }; - if (typeof queryParams.attributes == 'string') { + if (queryParams.attributes) { queries[queryName].output.attributes = queryParams.attributes.split(','); } else { queries[queryName].output.attributes = []; } - if (typeof queryParams.limit == 'string') + if (queryParams.limit) queries[queryName].output.limit = getIntegerValue(queryParams, 'limit'); - if (typeof queryParams.match_escalation_threshold == 'string') + if (queryParams.match_escalation_threshold) queryCondition.matchEscalationThreshold = getIntegerValue(queryParams, 'match_escalation_threshold'); - if (typeof queryParams.match_to == 'string') + if (queryParams.match_to) queryCondition.matchTo = queryParams.match_to.split(','); - if (typeof queryParams.query == 'string') + if (queryParams.query) queryCondition.query = queryParams.query; - if (typeof queryParams.script == 'string') + if (queryParams.script) scriptCondition.script = queryParams.script; if (queryCondition.query || scriptCondition.script) { if (!queryCondition.query) { @@ -77,15 +77,15 @@ function searchRequestBuilder(request) { } } - if (typeof queryParams.offset == 'string') + if (queryParams.offset) queries[queryName].output.offset = getIntegerValue(queryParams, 'offset'); - if (typeof queryParams.sort_by == 'string') + if (queryParams.sort_by) queries[queryName].sortBy = queryParams.sort_by.split(','); var message = {}; message.queries = queries; - if (typeof queryParams.timeout == 'string') + if (queryParams.timeout) message.timeout = getIntegerValue(queryParams, 'timeout'); return message; -------------- next part -------------- HTML����������������������������...Download