var parserCSV = function (string, field){
var parseString = string.split(/\n/),
attrs = parseString.shift().split(',');
var models = parseString.map(function (item) {
var result = {};
item.split(',').forEach(function (value, index){
result[attrs[index]] = value;
});
return result;
});
return function (value) {
return models.filter(function (model) {
return model[field] === value;
}).shift();
};
}
var module = (function(){
/**
* private variables are declared only inside the module
*/
var basket = [];
/**
* public variables are declared in the returned object
*/
return {
add: function(value){ ... },
count: function() { ... }
};
}());
module.add('a');
module.add('b');
module.add('c');
var total = module.count();
// a simple facade that masks the various browser-specific methods
function addEvent( element, event, callback ) {
if( window.addEventListener ) {
element.addEventListener( event, callback, false );
} else if( document.attachEvent ) {
element.attachEvent( 'on' + event, callback );
} else {
element[ 'on' + event ] = callback;
}
}
/*Default Task==================================================*/
gulp.task('default', function() {
gulp.run(['getbootjs','getshopcss','getbtbcss']);
});
/*==============================================================*/
/*Bootstrap JS Build==============================================*/
gulp.task('getbootjs', function () {
return gulp.src('src/bootstrap/js/*.js')
.pipe(concat('bootstrap.js'))
.pipe(gulp.dest('dist/'))
.pipe(connect.reload());
});
/*==============================================================*/
/*SHOP CSS Min Build============================================*/
gulp.task('getshopcss', function() {
return gulp.src('src/projects/shop/shop.less')
.pipe(less())
.pipe(gulp.dest('build/'))
.pipe(autoprefixer('last 3 versions'))
.pipe(cssmin())
.pipe(rename('styles.css'))
.pipe(gulp.dest('dist/shop/'))
.pipe(connect.reload());
});
/*==============================================================*/
/*BTB CSS Min Build=============================================*/
gulp.task('getbtbcss', function() {
return gulp.src('src/projects/btb/btb.less')
.pipe(less())
.pipe(gulp.dest('build/'))
.pipe(autoprefixer('last 3 versions'))
.pipe(cssmin())
.pipe(rename('styles.css'))
.pipe(gulp.dest('dist/btb/'))
.pipe(connect.reload());
});
<div class="success alert alert-success" role="alert">
<% if (description) { %>
<p class="description"> <%= description %> </p>
<% } %>
<p><%= message %></p>
</div>
var ids = _.pluck(collection.models, 'id');
collection.fetch({
data: {
ids : ids.join(',')
}
});