RestAPI.Content.getMembers(restContext, contentId, start, limit, function(err, result) { assert.ok(!err); assert.ok(result); assert.ok(_.isArray(result.results)); assert.ok(_.isString(result.nextToken) || _.isNull(result.nextToken)); // If a valid limit was specified (valid meaning above 0 and below the maximum amount of // 25), ensure the `nextToken` is shown if there were less than the expected amount of // results if (_.isNumber(limit) && limit > 0 && result.results.length < limit && limit <= 25) { assert.strictEqual(result.nextToken, null); } // Ensure each result has an id and a valid role _.each(result.results, function(result) { assert.ok(result); assert.ok(result.profile); assert.ok(result.profile.id); assert.ok(_.contains(['manager', 'editor', 'viewer'], result.role)); }); return callback(result); });
/** * ## ErrorAlert * setup to support testing */ /** * ### checkError * determine if there is an error and how deep it is. Take the * deepest level as the message and display it */ checkError (obj) { let errorMessage = ''; if (!_.isNull(obj)) { if (!_.isUndefined(obj.error)) { if (!_.isUndefined(obj.error.error)) { errorMessage = obj.error.error } else { errorMessage = obj.error } } else { errorMessage = obj } if (errorMessage !== '') { if (!_.isUndefined(errorMessage.message)) { SimpleAlert.alert('Error', errorMessage.message) } else { SimpleAlert.alert('Error', errorMessage) } } }// isNull }
Model.insert({ insert: "test" }, function (err) { _.isNull(err).should.be.ok; stub.callCount.should.equal(1); instance.save(function (err) { _.isNull(err).should.be.ok; stub.callCount.should.equal(2); //Re-find Model.find(function (err, documents) { //Cleanup Model.prototype.removePre("save"); _.isNull(err).should.be.ok; _.isArray(documents).should.be.ok; documents.length.should.equal(2); documents[0].should.have.property("insert"); documents[1].should.have.property("saved"); done(); }); }); });
var errors = setting.value.map((repo) => { var error = {}; var value = this.repoToString(repo, os); if (!repo.name) { error.name = i18n(ns + 'empty_name'); } else if (!repo.name.match(nameRegexp)) { error.name = i18n(ns + 'invalid_name'); } if (!value || !value.match(this.defaultProps.repoRegexes[os])) { error.uri = i18n(ns + 'invalid_repo'); } var priority = repo.priority; if ( _.isNaN(priority) || !_.isNull(priority) && ( !(priority === _.parseInt(priority, 10)) || os === 'CentOS' && (priority < 1 || priority > 99) ) ) { error.priority = i18n(ns + 'invalid_priority'); } return _.isEmpty(error) ? null : error; });
repo.object('asc:45068', function (err, obj) { obj.read = true; test.ok(_.isNull(err)); obj.profile(function (err, profile) { test.ok(_.isNull(err)); test.ok(_.contains(profile.models, 'amherst:manuscriptCModel')); obj.mixin(ManuscriptCModel); obj.viz(function (err, viz) { test.ok(err == null); test.equals(viz.length, 3); test.equals(viz[0].page, 'asc:45070'); test.equals(viz[0].jpeg, 'asc:45081'); test.equals(viz[0].jp2, 'asc:45080'); test.equals(viz[1].page, 'asc:45071'); test.equals(viz[1].jpeg, 'asc:45090'); test.equals(viz[1].jp2, 'asc:45089'); test.equals(viz[2].page, 'asc:45072'); test.equals(viz[2].jpeg, 'asc:45099'); test.equals(viz[2].jp2, 'asc:45097'); test.done(); }); }); });
_.each(importData.data[constkey], function (elem) { var prop; for (prop in elem) { if (elem.hasOwnProperty(prop)) { if (schema[constkey].hasOwnProperty(prop)) { if (!_.isNull(elem[prop])) { if (elem[prop].length > schema[constkey][prop].maxlength) { error += error !== "" ? "<br>" : ""; error += "Property '" + prop + "' exceeds maximum length of " + schema[constkey][prop].maxlength + " (element:" + constkey + " / id:" + elem.id + ")"; } } else { if (!schema[constkey][prop].nullable) { error += error !== "" ? "<br>" : ""; error += "Property '" + prop + "' is not nullable (element:" + constkey + " / id:" + elem.id + ")"; } } } else { error += error !== "" ? "<br>" : ""; error += "Property '" + prop + "' is not allowed (element:" + constkey + " / id:" + elem.id + ")"; } } } });
RpcClient.prototype.connect = function connect(callback) { this.logger.debug('RpcClient.connect(%s:%s)', this.config.host, this.config.port); if (!_.isUndefined(this.sender) && !_.isNull(this.sender)) { this.sender.close(); } this.createSender(); async.series({ connect: this.sender.connect.bind(this.sender), greeting: this.greetingCommand.bind(this), signon: this.signonCommand.bind(this), verify: this.verifyCommand.bind(this), context: this.contextCommand.bind(this) }, function(error, results) { if (error) { return callback(error, results); } callback(null, results.verify); }); };
_.each(indexEntries, function(indexEntry) { // Get the index entry key (rankedResourceId) and the index entry value (JSON stringified value) var rankedResourceId = _createRankedResourceId(indexEntry.resourceId, indexEntry.rank); var value = (_.isNull(indexEntry.value) || _.isUndefined(indexEntry.value)) ? DEFAULT_VALUE : indexEntry.value; // Stringify every value so that it can be safely parsed on the way back out value = JSON.stringify(value); // If the item's target index is private, we only put it into the private visibility bucket. // If it is loggedin, we put it into private and loggedin. If it is public, we put it into // all 3. This works out to slicing the visibility priorities from the target visibility // bucket and upward, inclusive var visibilityIndex = AuthzConstants.visibility.ALL_PRIORITY.indexOf(indexEntry.visibility); var visibilitiesToInsert = AuthzConstants.visibility.ALL_PRIORITY.slice(visibilityIndex); // Add each visibility bucket insert into the aggregated list of queries _.each(visibilitiesToInsert, function(visibility) { queries.push({ 'query': 'INSERT INTO "LibraryIndex" ("bucketKey", "rankedResourceId", "value") VALUES (?, ?, ?)', 'parameters': [_createBucketKey(indexName, indexEntry.libraryId, visibility), rankedResourceId, value] }); }); });
music_manager.getSongList(params, function(err, data) { if (!_.isNull(err)) { return callback("Unable to get music list"); } var jade_path = __dirname+'/views/music_songs'+(!_.isUndefined(params.skip)?'_list':'')+'_template.jade'; if (!fs.existsSync(jade_path)) { return callback("An error occured reading file"); } fs.readFile(jade_path, {encoding: "utf8"}, function(err, _jade) { var jade_params = { add_anchor: true, data: data, offset: (!_.isUndefined(params.skip)?params.skip:0) } var fn = jade.compile(_jade); var html = fn(jade_params); var return_params = { html: html, background_image: ("/images/record-full-blue.png") } return callback(null, return_params); }); })
setFilter: function(filter) { if(this.props.useExternal) { this.props.externalSetFilter(filter); return; } var that = this, updatedState = { page: 0, filter: filter }; // Obtain the state results. updatedState.filteredResults = _.filter(this.props.results, function(item) { var arr = _.values(item); for(var i = 0; i < arr.length; i++){ if ((arr[i]||"").toString().toLowerCase().indexOf(filter.toLowerCase()) >= 0){ return true; } } return false; }); // Update the max page. updatedState.maxPage = that.getMaxPage(updatedState.filteredResults); //if filter is null or undefined reset the filter. if (_.isUndefined(filter) || _.isNull(filter) || _.isEmpty(filter)){ updatedState.filter = filter; updatedState.filteredResults = null; } // Set the state. that.setState(updatedState); },
Whist.prototype.newNormalGame = function newNormalGame() { // Réinisialitation des structures internes pour préparer une nouvelle partie this.resetGame(); // Génération d'un jeu de carte, qu'on mélance et qu'on distribue aux joueurs var cards = new cardsLib.Cards(); cards.shuffle(); for (var pl of this.playersList) { this.players[pl].cards = new cardsLib.Cards(cards.pull(13)); this.players[pl].cards.sort(); } var playerWith3As = this.checkForHole(); if (!_.isNull(playerWith3As)) { // Détection d'un trou this.state = STATE_ANNOUNCE_AFTER_HOLE; this.players[playerWith3As].announce.name = "Trou"; this.players[playerWith3As].announce.holeConfirmed = false; // Recherche du bouche-trou for (var playerWith1As of _.without(this.playersList, playerWith3As)) { if (this.has1As(playerWith1As)) { this.players[playerWith1As].announce.name = "Bouche-trou"; this.players[playerWith1As].announce.holeConfirmed = false; this.players[playerWith1As].announce.myFriend = playerWith3As; this.players[playerWith3As].announce.myFriend = playerWith1As; break; } } } else { // Pas de trou this.state = STATE_ANNOUNCE; } this.currentPlayer = this.getNextPlayerFollowingAnnounces(); return this.state; }
Rules.prototype.apply = function(value) { if (_.isEmpty(value) && !_.isUndefined(this.rules['default'])) { value = this.rules['default']; } if (this.rules.required) { if (this.rules.required && (_.isUndefined(value) || (_.isUndefined(this.rules.type) && /^\s*$/.test(value)))) { throw this.Error("%p is a required parameter", "required", value); } } // if null is allowed, then no more rules need to be run if(this.rules.allownull && _.isNull(value)) return value; // if value is not required and is undefined, no more rules need to be run if (_.isUndefined(value)) return value; if (this.rules.filters) { value = this.filter(value); } if (this.rules.type) { if (typeof(this.rules.type) == "string" && typeof(is[this.rules.type]) == "function") { if (!is[this.rules.type](value)) throw this.Error("%p is not a " + this.rules.type, "type", value); } else if (typeof(this.rules.type == "function")) { if (!this.rules.type(value)) throw this.Error("%p is not a valid type", "type", value); } else { throw this.Error("%p is not a valid type", "type", value); } } if (this.rules.properties) { this.check(value); } return value; };
music_manager.musicSearch(opts, function(err, data) { if (!_.isNull(err)) { return callback("Error searching music"); } var jade_params = { more_docs: (!_.isUndefined(opts.limit) && data.total_rows >= opts.limit?true:false), data: data.rows } var jade_path = __dirname+'/views/'+opts.filename; if (!fs.existsSync(jade_path)) { return callback("An error occured reading file"); } fs.readFile(jade_path, {encoding: "utf8"}, function(err, _jade) { var fn = jade.compile(_jade); var html = fn(jade_params); var return_params = { html: html, background_image: (!_.isUndefined(data.rows[0].album_artwork)?data.rows[0].album_artwork:"/images/record-full-blue.png") } return callback(null, return_params); }) })
fs.readdir(basedir + '/controllers', function(err, files){ if (err) { completeFn(); } else { if (!_.isNull(files) && !_.isUndefined(files)) { if (files.length <= 0) { completeFn(); logger.log('warning', "no controllers found"); } else { var filesIndex = files.length; files.forEach(function(file){ filesIndex--; controllers.push({'basedir': basedir, 'file': file}); completeFn(); // bootController(app, basedir, file, function() { // if (filesIndex <= 0) { // completeFn(); // } // }); }); } }; } });
filePathForUrl(url) { if (_.isNull(url) || _.isUndefined(url)) { return null; } if (!_.isString(url)) { if (_.isObject(url)) { url = URL.format(url); if (!url) { return null; } } else { return null; } } if (!url.startsWith('file://')) { return null; } if (url.length <= 'file://'.length) { return null; } let relativePath = url.substring('file://'.length); relativePath = decodeURIComponent(relativePath); if (this.options.flattenDirectories) { relativePath = this.flattenedPathForPath(relativePath); } let absolutePath = path.join(this.options.baseDirectory, relativePath); return absolutePath; }
/** * ### checkErro * determine if there is an error and how deep it is. Take the * deepest level as the message and display it */ checkError(obj) { if (!this.alerter) { this.alerter = SimpleAlert; } let errorMessage = ''; if (!_.isNull(obj)) { if (!_.isUndefined(obj.error)) { if (!_.isUndefined(obj.error.error)) { errorMessage = obj.error.error; } else { errorMessage = obj.error; } } else { errorMessage = obj; } if (errorMessage !== '') { if (!_.isUndefined(errorMessage.message)) { this.alerter.alert('Error',errorMessage.message); } else { this.alerter.alert('Error',errorMessage); } } }//isNull }
sqlserver.executeSql(db.dbConfig, sql, function(err, result) { if (err) { return common.handleServiceErrorEx(HttpStatus.INTERNAL_SERVER_ERROR, util.format('Failed in finding the record by (instanceId: %s) in the broker database. DB Error: %j', instanceId, err), callback); } if (result.length === 0) { return common.handleServiceErrorEx(HttpStatus.INTERNAL_SERVER_ERROR, util.format('The information of the service instance (instanceId=%s) does not exist.', instanceId), callback); } var parameters = JSON.parse(encryptionHelper.decryptText(db.encryptionKey, instanceId, result[0].parameters)); var provisioningResult = result[0].provisioningResult; if (!(_.isNull(provisioningResult) || _.isUndefined(provisioningResult))) { provisioningResult = JSON.parse(encryptionHelper.decryptText(db.encryptionKey, instanceId, provisioningResult)); } var serviceInstance = {}; serviceInstance = { azureInstanceId: result[0].azureInstanceId, status: result[0].status, timestamp: result[0].timestamp, instance_id: instanceId, service_id: result[0].serviceId, plan_id: result[0].planId, organization_guid: result[0].organizationGuid, space_guid: result[0].spaceGuid, parameters: parameters, last_operation: result[0].lastOperation, provisioning_result: provisioningResult, }; log.info('Got the information of the service instance (instanceId=%s)', instanceId); callback(null, serviceInstance); });
oncreate: function * (next) { var blogdata = yield parse(this); if (_.isNull(this.session.user)) { var params = { title: '提示', msg: '请先登录', url: '/login', second: 2 }; this.body = yield showMsg(params, this.session, config, render); } else { var blog = new Blog(); blog.blog_title = blogdata.blogtitle; blog.blog_content = blogdata.blogcontent; blog.is_active = true; blog.author_id = this.session.user._id; blog.author_name = this.session.user.user_name; blog.blog_category = blogdata.blogcategory; blog.save(); this.body = { isSuccess: true }; } },
var canUserPostTopicToCategory = function (aUser, aCategory) { // Check if user is logged in. if (_.isUndefined(aUser) || _.isNull(aUser)) { return false; // Not logged in. } // Check if this category requires a minimum role to post topics. if (isDbg) { console.log( aCategory.roleReqToPostTopic, _.isNumber(aCategory.roleReqToPostTopic), aUser.role, aUser.role <= aCategory.roleReqToPostTopic ); } if (_.isNumber(aCategory.roleReqToPostTopic)) { return aUser.role <= aCategory.roleReqToPostTopic; } else { // No specified role required return true; } };
flattenQueryParams: function(params) { var value; var key; var stack = []; for(var unencodedKey in params) { if(params.hasOwnProperty(unencodedKey)) { key = encodeURIComponent(unencodedKey); value = params[unencodedKey]; if(_.isNull(value) || _.isUndefined(value) || value === '') { continue; } if(_.isArray(value)) { _.each(_.compact(value), function(item) { stack.push(key + '=' + encodeURIComponent(item)); }); } else { stack.push(key + '=' + encodeURIComponent(value)); } } } return stack.join('&'); }
this.BuildObservation = function (vitalEntryModel, cdaDocument, code, displayName, PQValue, PQUnit) { var x = cdaDocument; if (_.isUndefined(PQValue) || _.isNull(PQValue)) { return null; } if (_.isString(PQValue) && _.isEmpty(PQValue)) { return null; } return Σ(x, "component", Σ(x, "observation", A(x, "classCode", "OBS"), A(x, "moodCode", "EVN"), Σ(x, "templateId", A(x, "root", "2.16.840.1.113883.10.20.22.4.27")), Σ(x, "id", A(x, "root", uuid.v4())), cdaTools.BuildCodedValueLOINC(code, displayName, x), cdaTools.BuildStatusCode("completed", x), cdaTools.BuildEffectiveTime(null, null, vitalEntryModel.DateRecorded, true, x), cdaTools.CreateValuePQ(PQValue, PQUnit, x), cdaTools.CreateInterpretationCodeCE("N", "2.16.840.1.113883.5.83", null, null, x))); };
historics.forEach(function (historic) { var row = []; // row.push(chileanRut.format(historic.companyRut.substr(0, historic.companyRut.length - 1)) // + "-" + historic.companyRut.substr(historic.companyRut.length - 1, 1)); if (_.isNull(historic.companyRut)) { row.push(""); } else { row.push(chileanRut.format(historic.companyRut.substr(0, historic.companyRut.length - 1)) + "-" + historic.companyRut.substr(historic.companyRut.length - 1, 1)); } row.push(historic.companyName); row.push(moment(new Date(historic.registerDate)).format("MMMM")); row.push("PSICOSENSOMÉTRICO"); row.push("ANTOFAGASTA"); row.push(historic.patientLastName); row.push(_.isNull(historic.patientSecondLastName) ? "" : historic.patientSecondLastName); var tempName = ""; tempName += _.isNull(historic.patientName) ? "" : historic.patientName; tempName += _.isNull(historic.patientSecondName) ? "" : " " + historic.patientSecondName; row.push(tempName); // row.push(chileanRut.format(historic.patientRut.substr(0, historic.patientRut.length - 1)) // + "-" + historic.patientRut.substr(historic.patientRut.length - 1, 1)); if (_.isNull(historic.patientRut)) { row.push(""); } else { row.push(chileanRut.format(historic.patientRut.substr(0, historic.patientRut.length - 1)) + "-" + historic.patientRut.substr(historic.patientRut.length - 1, 1)); } row.push(_.isNull(historic.cc) ? "" : historic.cc); row.push(_.isNull(historic.respApplication) ? "" : historic.respApplication); row.push((moment(new Date(historic.registerDate)).format("DD/MM/YYYY"))); row.push(historic.examName); row.push(""); row.push(historic.examCost); row.push(""); row.push(""); rows.push(row); });
mml_builder.toXML(function(err, output){ assert.ok(_.isNull(err), _.isNull(err) ? '' : err.message); assert.ok(output); done(); });
fields.forEach(function (field) { if (!(_.isUndefined(entp[field]) || _.isNull(entp[field]))) { values.push(entp[field]) params.push('"' + escapeStr(camelToSnakeCase(field)) + '"=$' + (++cnt)) } })
function definedOrEmpty (d) { return (isUndefined(d) || isNull(d)) ? '' : d }
set: function (key, value, options) { var self = this; var extraProperties = this.extraProperties; var triggers = []; var changing, previous, changes, newType, newVal, def, cast, err, attr, attrs, dataType, silent, unset, currentVal, initial, hasChanged, isEqual; // Handle both `"key", value` and `{key: value}` -style arguments. if (_.isObject(key) || key === null) { attrs = key; options = value; } else { attrs = {}; attrs[key] = value; } options = options || {}; if (!this._validate(attrs, options)) return false; // Extract attributes and options. unset = options.unset; silent = options.silent; initial = options.initial; changes = []; changing = this._changing; this._changing = true; // if not already changing, store previous if (!changing) { this._previousAttributes = this.attributes; this._changed = {}; } previous = this._previousAttributes; // For each `set` attribute... for (attr in attrs) { newVal = attrs[attr]; newType = typeof newVal; currentVal = this._values[attr]; def = this._definition[attr]; if (!def) { if (extraProperties === 'ignore') { continue; } else if (extraProperties === 'reject') { throw new TypeError('No "' + attr + '" property defined on ' + (this.type || 'this') + ' model and allowOtherProperties not set.'); } else if (extraProperties === 'allow') { def = this._createPropertyDefinition(attr, 'any'); } } isEqual = this._getCompareForType(def.type); dataType = this._dataTypes[def.type]; // check type if we have one if (dataType && dataType.set) { cast = dataType.set(newVal); newVal = cast.val; newType = cast.type; } // If we've defined a test, run it if (def.test) { err = def.test.call(this, newVal, newType); if (err) { throw new TypeError('Property \'' + attr + '\' failed validation with error: ' + err); } } // If we are required but undefined, throw error. // If we are null and are not allowing null, throw error // If we have a defined type and the new type doesn't match, and we are not null, throw error. if (_.isUndefined(newVal) && def.required) { throw new TypeError('Required property \'' + attr + '\' must be of type ' + def.type + '. Tried to set ' + newVal); } if (_.isNull(newVal) && def.required && !def.allowNull) { throw new TypeError('Property \'' + attr + '\' must be of type ' + def.type + ' (cannot be null). Tried to set ' + newVal); } if ((def.type && def.type !== 'any' && def.type !== newType) && !_.isNull(newVal) && !_.isUndefined(newVal)) { throw new TypeError('Property \'' + attr + '\' must be of type ' + def.type + '. Tried to set ' + newVal); } if (def.values && !_.contains(def.values, newVal)) { throw new TypeError('Property \'' + attr + '\' must be one of values: ' + def.values.join(', ')); } hasChanged = !isEqual(currentVal, newVal); // enforce `setOnce` for properties if set if (def.setOnce && currentVal !== undefined && hasChanged) { throw new TypeError('Property \'' + key + '\' can only be set once.'); } // push to changes array if different if (hasChanged) { changes.push({prev: currentVal, val: newVal, key: attr}); } // keep track of changed attributes if (!isEqual(previous[attr], newVal)) { self._changed[attr] = newVal; } else { delete self._changed[attr]; } } // actually update our values _.each(changes, function (change) { self._previousAttributes[change.key] = change.prev; if (unset) { delete self._values[change.key]; } else { self._values[change.key] = change.val; } }); function gatherTriggers(key) { triggers.push(key); _.each((self._deps[key] || []), function (derTrigger) { gatherTriggers(derTrigger); }); } if (!silent && changes.length) self._pending = true; _.each(changes, function (change) { gatherTriggers(change.key); }); _.each(_.uniq(triggers), function (key) { var derived = self._derived[key]; if (derived && derived.cache && !initial) { var oldDerived = self._cache[key]; var newDerived = self._getDerivedProperty(key, true); if (!_.isEqual(oldDerived, newDerived)) { self._previousAttributes[key] = oldDerived; if (!silent) self.trigger('change:' + key, self, newDerived); } } else { if (!silent) self.trigger('change:' + key, self, self[key]); } }); // You might be wondering why there's a `while` loop here. Changes can // be recursively nested within `"change"` events. if (changing) return this; if (!silent) { while (this._pending) { this._pending = false; this.trigger('change', this, options); } } this._pending = false; this._changing = false; return this; },
service.parse(parseParameter, function (err, data) { _.isNull(data).should.be.eql(true); done(); });
collection.forEach((aModel, anIndex) => { // Group by if (this.options.groupBy) { aGroupBy = aModel ? aModel.get(this.options.groupBy) : null; if (aGroupBy != aLastGroupBy || anIndex === 0) { aGroupSize = this.getListGroupSizeWithOptions({ group: aGroupBy, state: state }); if (_.isNaN(aGroupSize) || _.isUndefined(aGroupSize) || _.isNull(aGroupSize)) { aGroupSize = this.options.orientation === ORIENTATION_VERTICAL ? this.options.groupHeight : this.options.groupWidth; } // Add a row to the list if (aColumnIndex !== 0) { aRow++; aCumulativePosition += aRowMaxSize; } // Calculate the margin between ListGroupView aGroupMargin = aCumulativePosition - aPreviousGroupPosition; // Cache ListGroupView informatioons this.groups.push({ group: aGroupBy, margin: aGroupMargin, size: aGroupSize }); aPreviousGroupPosition += aGroupMargin + aGroupSize; aCumulativePosition += aGroupSize; aColumnIndex = 0; aRowMaxSize = 0; aLastGroupBy = aGroupBy; } } aSize = this.getListItemSizeAtIndexWithOptions(anIndex, { model: aModel, state: state }); if (_.isNaN(aSize) || _.isUndefined(aSize) || _.isNull(aSize) ) { aSize = this.options.orientation === ORIENTATION_VERTICAL ? this.options.itemHeight : this.options.itemWidth; } aRowMaxSize = Math.max(aRowMaxSize, aSize); if (!this.rowItems[aRow]) { this.rowItems.push([]); } if (orientation === ORIENTATION_VERTICAL) { aColumn = (aColumnIndex % itemsPerRow); aColumnWidth = (this.listWidth / itemsPerRow); this.positionAtIndex[anIndex] = { row: aRow, column: aColumn, index: anIndex, top: aCumulativePosition, right: (aColumn + 1) * aColumnWidth, bottom: aCumulativePosition + aSize, left: aColumn * aColumnWidth }; this.rowItems[aRow].push(this.positionAtIndex[anIndex]); } else { aColumn = (aColumnIndex % itemsPerRow); aColumnHeight = (this.listHeight / itemsPerRow); this.positionAtIndex[anIndex] = { row: aRow, column: aColumn, index: anIndex, top: aColumn * aColumnHeight, right: aCumulativePosition + aSize, bottom: (aColumn + 1) * aColumnHeight, left: aCumulativePosition }; this.rowItems[aRow].push(this.positionAtIndex[anIndex]); } if (!this.rows[aRow]) { // Start and end will be updated at row change because we keep // a reference to the position object this.rows[aRow] = { start: this.positionAtIndex[anIndex], end: this.positionAtIndex[anIndex] }; } else { this.rows[aRow].end = this.positionAtIndex[anIndex]; } if (aColumnIndex % itemsPerRow === itemsPerRow - 1 || anIndex === this.collection.length - 1) { aCumulativePosition += aRowMaxSize; if (aModel) { aContainterSize += aRowMaxSize; } // Change the bottom property of every column in row // only if itemsPerRow > 1 if (itemsPerRow > 1) { for (let i = 0; i < this.rowItems[aRow].length; i++) { if (orientation === ORIENTATION_VERTICAL) { this.rowItems[aRow][i].bottom = this.rowItems[aRow][i].top + aRowMaxSize; } else { this.rowItems[aRow][i].right = this.rowItems[aRow][i].left + aRowMaxSize; } } } aRowMaxSize = 0; aRow++; aColumnIndex = 0; } else { aColumnIndex++; } });
LocalStorage.prototype.hasKey = function (key) { var item = localStorage.getItem(key); return !(_.isNull(item) || _.isUndefined(item)); };
var valid = _.reject(this.date, function(val) { return val === "" || _.isNull(val); });