How to use the findWhere function from underscore
Find comprehensive JavaScript underscore.findWhere code examples handpicked from public code repositorys.
89 90 91 92 93 94 95 96 97 98var dir = appConfig.STORY + "/" + content.localData.code if (fs.existsSync(dir) && _.findWhere(localMap, { "identifier": content.identifier })) { var localContent = _.findWhere(localMap, { "identifier": content.identifier }) if (content.localData.pkgVersion !== localContent.localData.pkgVersion) { asyncTask.push(function (callback) {
+ 5 other calls in file
382 383 384 385 386 387 388 389 390 391deviceService.getDeviceByName(id, service, subservice, function (error, ngsiDevice) { if (error) { callback(error); } else { for (let i = 0; i < attributes.length; i++) { const lazyAttribute = _.findWhere(ngsiDevice.lazy, { name: attributes[i] }); const command = _.findWhere(ngsiDevice.commands, { name: attributes[i] }); let attributeType = 'string'; if (command) {
32 33 34 35 36 37 38 39 40 41const compiled = {}; const templateCache = {}; function maxlength(field) { const validation = field.validate || []; const ml = _.findWhere(validation, { type: 'maxlength' }) || _.findWhere(validation, { type: 'exactlength' }); if (ml) { return _.isArray(ml.arguments) ? ml.arguments[0] : ml.arguments; } return null;
36 37 38 39 40 41 42 43 44 45 46 47return done(null, returnList); }; exports.findByName = function(name, done) { var _ = require('underscore'); var returnList = _.findWhere(admins, {name: name}); return done(null, returnList); }; exports.getRandomAdmin = function(done) {
+ 4 other calls in file
GitHub: Barry-Yellow/teddy
187 188 189 190 191 192 193 194 195 196return; } spinner.succeed('Tags loaded'); const tags = JSON.parse(body).tags; const defaultTag = _.findWhere(tags, { id: prefs.importer.tag }); const defaultTagName = defaultTag ? defaultTag.name : 'No tag'; inquirer.prompt([ {
163 164 165 166 167 168 169 170 171 172PouchDB('testdb', function (err, db) { db.gql(query, function (err, actual) { if (!err) { var intersection = expected.filter(function (n) { return _.findWhere(actual.rows, n) !== undefined; }); intersection.should.have.length(expected.length); actual.rows.should.have.length(expected.length); done();
+ 6 other calls in file
GitHub: laosb/meteor

186 187 188 189 190 191 192 193 194 195var toolIsopack = new isopack.Isopack; toolIsopack.initFromPath( latestReleaseToolPackage, tropohouse.default.packagePath(latestReleaseToolPackage, latestReleaseToolVersion)); var toolRecord = _.findWhere(toolIsopack.toolsOnDisk, {arch: archinfo.host()}); // XXX maybe we shouldn't throw from this background thing // counter: this is super weird and should never ever happen.
+ 3 other calls in file
GitHub: HWRobotics/meteor

51 52 53 54 55 56 57 58 59}; var ipAddress = function () { var netroute = require('netroute'); var info = netroute.getInfo(); var defaultRoute = _.findWhere(info.IPv4 || [], { destination: "0.0.0.0" }); if (! defaultRoute) { return null; }
+ 3 other calls in file
GitHub: Tarang/meteor

180 181 182 183 184 185 186 187 188 189var toolUnipackage = new unipackage.Unipackage; toolUnipackage.initFromPath( latestReleaseToolPackage, tropohouse.default.packagePath(latestReleaseToolPackage, latestReleaseToolVersion)); var toolRecord = _.findWhere(toolUnipackage.toolsOnDisk, {arch: archinfo.host()}); // XXX maybe we shouldn't throw from this background thing // counter: this is super weird and should never ever happen.
underscore.keys is the most popular function in underscore (11266 examples)