How to use the lazy.first function in lazy

To help you get started, we’ve selected a few lazy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github persvr / pintura / lib / store / sql.js View on Github external
executeQuery: function(sql, options){
			// executes a query with provide start and end parameters, calculating the total number of rows
			if(options){
				if(typeof options.start === "number"){
					var countSql = sql.replace(/select.*?from/i,"SELECT COUNT(*) as count FROM");
					if(typeof options.end === "number"){
						sql += " LIMIT " + (options.end - options.start + 1);
					}
					sql += " OFFSET " + options.start;
					var results = this.executeSql(sql, options.parameters).rows;
					var lengthObject = first(this.executeSql(countSql, options.parameters).rows);
					
					results.totalCount = lengthObject.count;
					return results; 
				}
			}
			var results = this.executeSql(sql, options.parameters).rows;
			results.totalCount = results.length;
			return results; 			
		},
		getSchema: function(){
github persvr / pintura / lib / store / sql.js View on Github external
get: function(id){
			var object = first(store.executeSql("SELECT * FROM " + config.table + " WHERE " + config.idColumn + "=?", [id]).rows);
			if(object){
				defineProperty(object.__proto__ = {
					getId: function(object){
						return this[config.idColumn];
					}
				}, "getId", {enumerable: false});
			}
			return object;
		},
		"delete": function(id){

lazy

Lazy lists for node

MIT
Latest version published 11 years ago

Package Health Score

67 / 100
Full package analysis