'use strict';

module.exports = function(dialect) {
	dialect.operators.fetching.add('$json', {
		fn: function(value, end) {
			if (end) value = {value: value};
			return dialect.buildBlock('term', {term: value, type: 'value'});
		}
	});

	dialect.operators.fetching.add('$array', {
		fn: function(value, end) {
			if (!_.isArray(value)) {
				value = [value]
			}
			return dialect.buildBlock('term', {term: value, type: 'value'});
		}
	});

	dialect.operators.fetching.add('$isEmptyArray', {
		fn: function(value) {
			return dialect.buildBlock('term', {term: value, type: 'isEmptyArray'});
		}
	});
};

@@ -6,16 +6,47 @@
 strict';
+%0Avar _ = require('underscore');
 %0A%0Amodule

add underscore