Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_.isEqual(1);
/**
* _.range
*/
_.range(0, 10)[4] == 4
// $ExpectError string. This type is incompatible with number
_.range(0, 'a');
// $ExpectError string cannot be compared to number
_.range(0, 10)[4] == 'a';
/**
* _.bind
*/
_.bind(function(a,b){return this.x+a+b;}, {x: 1}, 2, 3);
// $ExpectError number. This type is incompatible with the expected param type of function type
_.bind(123)
/**
* _.bindAll
*/
_.bindAll({msg: 'hi', greet: function(){ return this.msg;}}, 'greet');
_.bindAll({msg: 'hi', greet: function(){ return this.msg;}}, 'greet', 'toString');
_.bindAll({msg: 'hi', greet: function(){ return this.msg;}}, ['greet'], 'toString');
/**
* _.extend
*/
Bucket.prototype.uploadFile = function (filePath, callback) {
var fileKey = filePath.replace(this.options.srcPath, '').substr(1);
fs.readFile(filePath, _.bind(function (err, fileBuffer) {
var params = this._params({
Key: fileKey,
Body: fileBuffer,
ContentType: mime.lookup(filePath)
});
// Remove all browser caching on specified
// resources
if (_.contains(this.options.noCache, fileKey)) {
_.extend(params, {
CacheControl: 'no-cache, no-store, must-revalidate',
Expires: (new Date()).toISOString()
});
}
this.s3.putObject(params, callback);
render: function () {
this.$el.empty();
this.$el.html(this.template({
tab: this.model.get('id'),
title: this.model.get('itemName')
}));
this.$('.panel-body').empty().html(this.bodyView.$el);
this.alertPanel = new AlertPanelView({el: this.$('#alert-panel')});
this.$tab.tab('show');
this.listenTo(Backbone, 'exception', _.bind(this.showExceptionMessage, this)); // handle global event!
return this;
},
changeBodyView: function (bodyView) {
trackChildView(view) {
if (!_.contains(this.childViews, view)) {
this.childViews.push(view);
view.on('destroyed', _.bind(this.untrackChildView, this, view));
}
return view;
},
_bindGlobalClick: function () {
$(document).bind('click.' + this.cid, _.bind(this._onGlobalClick, this));
},
_fetchUserMembership: function(project, userSpec, callback) {
this._users.get({
id: userSpec.id
}, _.bind(function(err, user) {
if (err) {
callback(err);
return;
}
this._fetchProjectRolesForUser(project, user, function(err, roles) {
if (err) {
callback(err);
return;
}
callback(null, {
id: user.id,
name: user.name,
email: user.email,
roles: roles,
initialize: function(attrs, options) {
Model.prototype.initialize.apply(this, arguments);
this.columnModel = options.columnModel;
this.dataModel = options.dataModel;
this.domState = options.domState;
this.on('change:fixedHeight', this._resetSyncHeightHandler);
if (options.domEventBus) {
this.listenTo(options.domEventBus, 'windowResize', this._onResizeWindow);
this.listenTo(options.domEventBus, 'dragmove:resizeHeight',
_.debounce(_.bind(this._onDragMoveForHeight, this)));
}
this._resetSyncHeightHandler();
},
strokeOpacity: 1,
fill: true,
fillOpacity: 0.75,
fillColor: '#BEE37B',
strokeRamp: 'Blues',
strokeColorKey: null,
fillRamp: 'Reds',
fillColorKey: null,
logFlag: false,
linearFlag: true,
clampingFlag: false,
quantileFlag: false,
minClamp: 0,
maxClamp: 100000
},
ramps: _.map(colorbrewer, _.bind(function (ramp, name) {
var n = "<ul class="m-color-ramp">";
_.each(ramp[6], function (color, i) {
n += "<li style="background-color: " + color + "">";
});
n += '</li></ul>';
this[name] = {
value: ramp[6],
display: n
};
return this;
}, {}))[0]
});
export default GeoJSONStyle;
_renderSearch: function($where) {
$where.find(".controls .search-input").searchInput({
placeholder: this.searchPlaceholder,
initialVal: this.searchFor,
onfirstsearch: _.bind(this._firstSearch, this),
onsearch: _.bind(this.searchItems, this),
onclear: _.bind(this.clearSearch, this)
});
return $where;
},
setTimeout(function() {
orderedAsync.concat(package.pathsToAdd, _.bind(package._addPath, package), function(err, paths) {
if (err) throw err;
var currentFilePaths = _(package.paths).map(function(p) { return p.path; });
paths.forEach(function(p) {
if (currentFilePaths.indexOf(p.path) == -1) {
package.paths.push(p);
currentFilePaths.push(p.path);
}
});
});
}, 0);
},