function heapRange(max){ var h = new Heap() _.forEach(_.range(max), d => h.push(d)) return h; }
var Fools = require('./../fools'); var _ = require('lodash'); var util = require('util'); var point = {x: 3, y: 4, z: 5}; var rate = Fools.rate() .prop('x', function(x){ return Math.abs(x - point.x); }, 1) .prop('y', function(y){ return Math.abs(y - point.y); }, 1) .prop('z', function(z){ return Math.abs(z - point.z); }, 1); var points = _.map(_.range(0, 50), function(){ return { x: Math.round(Math.random() * 10), y: Math.round(Math.random() * 10), z: Math.round(Math.random() * 10) } }); console.log(points); rate.add(points); console.log('nearest point to %s: %s', util.inspect(point), util.inspect(rate.worst())); console.log('within 3 to the point: ', util.inspect(rate.select(0, 3)));
import _ from 'lodash'; export const themeColors = ['red', 'cyan', 'purple', 'lime', 'indigo', 'pink', 'teal', 'green', 'orange', 'deep-purple']; export const ACCELERATOR_KEYS = { 17: 'Ctrl', }; export const MODIFIER_KEYS = { 16: 'Shift', 18: 'Alt', }; export const ACTION_KEYS = _.transform(_.range(26), (final, current) => { // letters final[current + 65] = String.fromCharCode(current + 65); // eslint-disable-line }, _.transform(_.range(10), (final, current) => { // digits final[current + 48] = current.toString(); // eslint-disable-line }, _.transform(_.range(12), (final, current) => { // f-keys final[current + 112] = 'F' + (current + 1).toString(); // eslint-disable-line }, { 33: 'PageUp', 34: 'PageDown', 35: 'End', 36: 'Home', 37: 'Left', 38: 'Up', 39: 'Right', 40: 'Down', 45: 'Insert', 46: 'Delete', 186: ';',
matrix = points.map((point, index) => _.range(degree + 2) .map(i => (degree - i >= 0) ? Math.pow(point[0], degree - i) : Math.pow(-1, index) ) // x^degree, x^degree-1, ..., x^0, -1^row
handleScrollToPercentage() { this.setState({ data: this.state.data.concat(_.range(100)), }); }
return _.range(0, this.height).map((y) => { return _.range(0, this.width).map((x) => { return this.get(x, y) ? "*" : "_"; }).join(""); }).join("\n") + "\n";
([as, x]) => _.map( _.zip(as, _.range(as.length)), ([a, y]) => [a, x, y], ),
statsService.stat(data, function (e) { if (e) return done(e); try { // test influx endpoint sinon.assert.calledOnce(influx.InfluxDB.prototype.writeMeasurement); var measurement = influx.InfluxDB.prototype.writeMeasurement.getCall(0).args[0]; var points = influx.InfluxDB.prototype.writeMeasurement.getCall(0).args[1]; should(points.length).eql(1); var point = points[0]; should(measurement).eql('test'); should(point).have.propertyByPath('fields', 'count').eql(1); should(point).have.propertyByPath('fields', 'value').eql(2); should(point).not.have.property('timestamp'); // test stathat endpoint // there are 3 points sent to stathat for count and value // 1 default and 1 for each tag (2) sinon.assert.callCount(stathat.trackEZCount, 3); sinon.assert.callCount(stathat.trackEZValue, 3); // collect the output from the stubbed stathat functions var countsCalledWith = _.map(_.range(3), function (i) { return stathat.trackEZCount.getCall(i).args; }); var valuesCalledWith = _.map(_.range(3), function (i) { return stathat.trackEZValue.getCall(i).args; }); var calledWith = _.concat(countsCalledWith, valuesCalledWith); // the first argument to the endpoint should be the stathat key // the 4th argument should be a callback function _.forEach(calledWith, function (args) { should(args[0]).equal(config.stathat.key); should(args[3]).be.Function(); }); // the second argument to the endpoint should be the name.tagname // we're not sure about the order in which they'll call the endpoint // separate the nth arguments into groups // the arguments grouped by their position // [1st arguments[], 2nd[], 3rd[], ...] var countGroupArgs = _.zip.apply(this, countsCalledWith); var valueGroupArgs = _.zip.apply(this, valuesCalledWith); // *** counts *** _.forEach([ // the expected names 'test.count', 'test.count.tag1.string1', 'test.count.tag2.string2' ], function (value) { // the 2nd arguments of the countsCalledWith should(countGroupArgs[1]).containEql(value); }); // the third argument should be a value // here array of values from each call should(countGroupArgs[2]).deepEqual([1, 1, 1]); // *** values *** _.forEach([ // the expected names 'test.value', 'test.value.tag1.string1', 'test.value.tag2.string2' ], function (value) { // the 2nd arguments of the countsCalledWith should(valueGroupArgs[1]).containEql(value); }); // the third argument should be a value // here array of values from each call should(valueGroupArgs[2]).deepEqual([2, 2, 2]); return done(); } catch (e) { return done(e); } });
const _ = require('lodash'); const MAX_KERNEL_SIZE = 8; const VARIANCE = 1.0; function normalDist(x, sigma) { if (sigma == 0) return x === 0 ? 1 : 0; return 1.0 / (Math.sqrt(Math.PI * 2) * sigma) * Math.exp(-x*x / (2 * sigma * sigma)); } for (let i=0; i<MAX_KERNEL_SIZE; i++) { const kernel = _.range(MAX_KERNEL_SIZE).map(v => (v > i) ? 0 : normalDist(v, Math.sqrt(i))); const sum = kernel.reduce((a, b) => a + b, 0) * 2 - kernel[0]; const normalizedKernel = kernel.map(v => v / sum); console.log(` { ${normalizedKernel.join(', ')} },`); }
const AWS = require('aws-sdk'); const colors = require('colors'); const _ = require('lodash'); const credentials = require('./aws.json'); const config = require('./config'); console.log('Cleaning up..'.green); const lambda = new AWS.Lambda(credentials); const deleteLambda = index => new Promise((resolve, reject) => { lambda.deleteFunction({ FunctionName: `benchmark-${index}` }, (err, res) => { if (err) { return reject(err); } resolve(res); }); }); Promise.all(_.range(config.count).map(deleteLambda)) .then(() => { console.log(`Done`.green); }) .catch(err => { console.error(err); });
// console.log('hello world'); // // var a = 3; // var b = 2; // var c = a + b; // console.log(a, b, c); // // var nums = [3,4,5]; // var sum = nums.reduce(function(acc, num){ // return acc + num; // }); // console.log(nums, sum); // // var math = require('./math'); // var d = math.add(a, b); // console.log('d:', d); // // var e = math.product(a,b); // console.log(e); var _ = require('lodash') var userId1 = _.uniqueId('user_'); var userId2 = _.uniqueId('user_'); var userId3 = _.uniqueId('user_'); console.log(userId1, userId2, userId3); var range = _.range(30, -40, -3); console.log(range);
? badgeReg.certifierCount().then((count) => { return range(count); })
data: _.map(_.range(x), function (num) { return _.range(y) })
map: _.range(sideInt).map(y => _.range(sideInt).map(x => getTile(x, y, tileTypes.land))),
return new Grid(_.range(height).map(function() { return _.range(width).map(function() { return (_.random(0, 1) === 1) ? Grid.LIVE : Grid.DEAD; }); }));
var _ = require('lodash'); var R = require('../..'); var maxBy = R.maxBy; var vals = _.chain(_.range(50, 500, 5)) .shuffle() .map(function(val) { return {key: val, val: String.fromCharCode(val)}; }) .value(); var computer = R.prop('val'); var maxVal = maxBy(computer); module.exports = { name: 'maxBy', tests: { '_.max': function() { _.max(vals, computer); }, 'maxBy(computer, nums)': function() { maxBy(computer, vals); }, 'maxBy(computer)(vals)': function() { maxBy(computer)(vals); }, 'maxVal(vals)': function() { maxVal(vals); } } };
yValues() { return _.range(this.height).map((i) => this.bottom + i * this.interval); }
return delayed(() => { const paths = wrapper.render().find(options.deepestTag); const colors = d3.scale.category10().domain(_.range(3)); expect(paths.first().prop(options.colorProperty)).toEqual(colors(0)); expect(paths.last().prop(options.colorProperty)).toEqual(colors(2)); });
const _ = require('lodash'); const async = require('async'); const ff = require('..'); const $ = ff.RuleBuilder; const N = _.range(100); exports.testSimpleMatch = function (test) { var thenCalls = 0; var cbCalls = 0; const ffm = ff.Matcher( $( (o, p, c, pc, match) => match(o === 42) ).then( (objs, next) => next(thenCalls++) ) ); N.forEach((obj) => ffm(obj, (err) => { test.ifError(err); cbCalls++; })); test.equals(thenCalls, 1); test.equals(cbCalls, N.length); test.done(); }; exports.testSimpleNoMatch = function (test) {
return delayed(() => { const paths = wrapper.render().find(options.deepestTag); const colors = d3.scale.ordinal().range(['red', 'green', 'blue']).domain(_.range(3)); expect(paths.first().prop(options.colorProperty)).toEqual(colors(0)); expect(paths.last().prop(options.colorProperty)).toEqual(colors(2)); });
allowNew, customMenuItem, disabled, largeDataSet, multiple, preSelected, selected, overflowTo, } = this.state; let props = {allowNew, disabled, multiple, selected}; if (customMenuItem) { props.renderMenuItem = this._renderMenuItem; } let bigData = range(0, 2000).map((option) => { return {name: option.toString()}; }); let dataSourceLink = <a href={CENSUS_URL} target="_blank"> U.S. Census Bureau </a>; return ( <div className="example"> <div className="jumbotron"> <div className="container"> <h2>React Bootstrap Typeahead Example</h2> </div> </div>
import { range, toNumber } from 'lodash'; range(1); toNumber('1');
const onShuffle = () => onChange(CONTROL_TYPES.EXCLUSIONS, [ ...new Set( _.sampleSize(_.range(1, numTargets - 1), _.random(1, numTargets - 2)), ), ]);
activations: () => _.range(h.length+1).map(h => (h+1)*2).map(index => { let layer = net.layers[index] let d = layer.out_act.depth return _.range(d).map(c => layer.out_act.get(0,0,c)) }),
Dog.prototype.bark = function (times) { return _.map(_.range(times), function (i) { return 'Woof #' + i }) }
}).then(function(maxItem){ var allItems = _.range(0, maxItem).reverse(); return _.chunk(allItems, PARALLELISM); }).each(function(chunk){
describe('fhir support', function () { var context = {}; // populated by refmodel common methods var self = this; var numPatients = 3; var numAllersPerPt = 3; var numProcsPerPt = 4; var options = { fhir: true }; refmodel.prepareConnection({ dbName: 'fhirsupport' }, context)(); var sourceIds; it('add sources', function (done) { refmodel.addSourcesPerPatient(context, _.times(numPatients + 1, _.constant(1)), function (err, result) { if (err) { done(err); } else { sourceIds = result; done(); } }); }); it('entry.patientKeyToId missing', function (done) { entry.patientKeyToId(context.dbinfo, 'testdemographics', 'pat0', function (err, id) { expect(err).not.to.exist; expect(id).not.to.exist; done(); }); }); var patientSamples = _.range(numPatients + 1).map(function (ptIndex) { var sourceKey = util.format('%s.%s', ptIndex, 0); return refmodel.createTestSection('testdemographics', sourceKey, 1)[0]; }); var patientIds = []; patientSamples.forEach(function (patientSample, ptIndex) { var sampleClone = _.cloneDeep(patientSample); var patKey = util.format('pat%s', ptIndex); var title = util.format('create testdemographics for %s', patKey); var momentBefore = moment(); it(title, function (done) { var itself = this; section.save(context.dbinfo, 'testdemographics', patKey, sampleClone, sourceIds[ptIndex], options, function (err, result) { if (err) { done(err); } else { expect(result).to.exist; expect(result.versionId).to.equal('1'); common.verifyMoment.call(itself, momentBefore, result.lastUpdated); patientIds.push(result.id); done(); } }); }); }); _.range(numPatients).forEach(function (ptIndex) { var patKey = util.format('pat%s', ptIndex); it('entry.patientKeyToId ' + patKey, function (done) { entry.patientKeyToId(context.dbinfo, 'testdemographics', patKey, function (err, id) { expect(err).not.to.exist; expect(id.toString()).to.equal(patientIds[ptIndex]); done(); }); }, self); }); _.range(numPatients).forEach(function (ptIndex) { var patKey = util.format('pat%s', ptIndex); it('entry.idToPatientKey ' + patKey, function (done) { entry.idToPatientKey(context.dbinfo, 'testdemographics', patientIds[ptIndex], function (err, result) { expect(err).not.to.exist; expect(result.key).to.equal(patKey); expect(result.invalid).to.be.false; expect(!!result.archived).to.be.false; done(); }); }, self); }); _.range(numPatients).forEach(function (ptIndex) { var patKey = util.format('pat%s', ptIndex); it('entry.get testdemographics ' + patKey, function (done) { entry.get(context.dbinfo, 'testdemographics', patKey, patientIds[ptIndex], options, function (err, entry) { if (err) { done(err); } else { expect(entry.data).to.deep.equal(patientSamples[ptIndex]); done(); } }); }); }); it('entry.replace pat2', function (done) { var itself = this; var sampleClone = _.cloneDeep(patientSamples[3]); var momentBefore = moment(); entry.replace(context.dbinfo, 'testdemographics', 'pat2', patientIds[2], sourceIds[3], sampleClone, options, function (err, result) { if (err) { done(err); } else { expect(result.id).to.equal(patientIds[2]); expect(result.versionId).to.equal('2'); common.verifyMoment.call(itself, momentBefore, result.lastUpdated); done(); } }); }); it('entry.get testdemographics pat2 after replace', function (done) { entry.get(context.dbinfo, 'testdemographics', 'pat2', patientIds[2], options, function (err, entry) { if (err) { done(err); } else { expect(entry.data).to.deep.equal(patientSamples[3]); done(); } }); }); var momentBeforeDelete; it('entry.remove pat2', function (done) { momentBeforeDelete = moment(); entry.remove(context.dbinfo, 'testdemographics', 'pat2', patientIds[2], done); }); it('entry.idToPatientKey removed pat2', function (done) { entry.idToPatientKey(context.dbinfo, 'testdemographics', patientIds[2], function (err, result) { expect(err).not.to.exist; expect(result.key).to.equal('pat2'); expect(result.invalid).to.be.false; expect(result.archived).to.be.true; done(); }); }, self); it('entry.get testdemographics pat2 after remove', function (done) { var itself = this; entry.get(context.dbinfo, 'testdemographics', 'pat2', patientIds[2], options, function (err, entry) { if (err) { done(err); } else { expect(entry.archived_on).to.exist; expect(entry.data).to.deep.equal(patientSamples[3]); expect(entry.archived).to.equal(true); common.verifyMoment.call(itself, momentBeforeDelete, entry.archived_on.toISOString()); done(); } }); }); var numAllergies = 4; var allergySamples = _.range(2).map(function (ptIndex) { var sourceKey = util.format('%s.%s', ptIndex, 0); return refmodel.createTestSection('testallergies', sourceKey, numAllergies); }); allergySamples = _.flatten(allergySamples); var allergiesIds = []; allergySamples.forEach(function (allergySample, index) { var sampleClone = _.cloneDeep(allergySample); var ptIndex = Math.floor(index / numAllergies); var patKey = util.format('pat%s', ptIndex); var title = util.format('create testallergies %s for %s', index, patKey); var momentBefore = moment(); it(title, function (done) { var itself = this; section.save(context.dbinfo, 'testallergies', patKey, sampleClone, sourceIds[ptIndex], options, function (err, result) { if (err) { done(err); } else { expect(result).to.exist; expect(result.versionId).to.equal('1'); common.verifyMoment.call(itself, momentBefore, result.lastUpdated); allergiesIds.push(result.id); done(); } }); }); }); _.range(2).forEach(function (ptIndex) { var patKey = util.format('pat%s', ptIndex); _.range(4).forEach(function (allergiesIndex) { it('entry.idToPatientKey (testallergies) ' + patKey, function (done) { var index = ptIndex * numAllergies + allergiesIndex; entry.idToPatientKey(context.dbinfo, 'testallergies', allergiesIds[index], function (err, result) { expect(err).not.to.exist; expect(result.key).to.equal(patKey); expect(result.invalid).to.be.false; expect(!!result.archived).to.be.false; done(); }); }, self); }); }); it('entry.idToPatientKey (testallergies) invalid id', function (done) { entry.idToPatientKey(context.dbinfo, 'testallergies', 'x', function (err, result) { expect(err).not.to.exist; expect(result.invalid).to.equal(true); done(); }); }); it('entry.idToPatientKey (test allergies) valid id that does not point to a record', function (done) { entry.idToPatientKey(context.dbinfo, 'testallergies', '123456789012345678901234', function (err, result) { expect(err).not.to.exist; expect(result).not.to.exist; done(); }); }); _.range(2).forEach(function (ptIndex) { var patKey = util.format('pat%s', ptIndex); _.range(4).forEach(function (allergiesIndex) { it('entry.idToPatientInfo (testallergies) ' + patKey, function (done) { var index = ptIndex * numAllergies + allergiesIndex; entry.idToPatientInfo(context.dbinfo, 'testallergies', allergiesIds[index], function (err, result) { expect(err).not.to.exist; expect(result.key).to.equal(patKey); expect(result.reference).to.equal(patientIds[ptIndex]); done(); }); }, self); }); }); it('entry.idToPatientInfo (testallergies) invalid id', function (done) { entry.idToPatientInfo(context.dbinfo, 'testallergies', 'x', function (err, result) { expect(err).not.to.exist; expect(result).not.to.exist; done(); }); }); it('entry.idToPatientInfo (test allergies) valid id that does not point to a record', function (done) { entry.idToPatientInfo(context.dbinfo, 'testallergies', '123456789012345678901234', function (err, result) { expect(err).not.to.exist; expect(result).not.to.exist; done(); }); }); _.range(2).forEach(function (ptIndex) { var patKey = util.format('pat%s', ptIndex); _.range(4).forEach(function (allergiesIndex) { var patKey = util.format('pat%s', ptIndex); var index = 4 * ptIndex + allergiesIndex; var title = util.format('entry.get testallergies %s for %s', index, patKey); it(title, function (done) { entry.get(context.dbinfo, 'testallergies', patKey, allergiesIds[index], options, function (err, entry) { if (err) { done(err); } else { expect(entry.data).to.deep.equal(allergySamples[index]); done(); } }); }); }); }); it('entry.replace testallergies 3 for pat0', function (done) { var itself = this; var sampleClone = _.cloneDeep(allergySamples[2]); var momentBefore = moment(); entry.replace(context.dbinfo, 'testallergies', 'pat0', allergiesIds[3], sourceIds[3], sampleClone, options, function (err, result) { if (err) { done(err); } else { expect(result.id).to.equal(allergiesIds[3]); expect(result.versionId).to.equal('2'); common.verifyMoment.call(itself, momentBefore, result.lastUpdated); done(); } }); }); it('entry.get testallergies 3 after replace', function (done) { entry.get(context.dbinfo, 'testallergies', 'pat0', allergiesIds[3], options, function (err, entry) { if (err) { done(err); } else { expect(entry.data).to.deep.equal(allergySamples[2]); done(); } }); }); it('entry.remove testallergies 3', function (done) { momentBeforeDelete = moment(); entry.remove(context.dbinfo, 'testallergies', 'pat0', allergiesIds[3], done); }); it('entry.idToPatientKey removed testallergies 3', function (done) { entry.idToPatientKey(context.dbinfo, 'testallergies', allergiesIds[3], function (err, result) { expect(err).not.to.exist; expect(result.key).to.equal('pat0'); expect(result.invalid).to.be.false; expect(result.archived).to.be.true; done(); }); }, self); it('entry.get testallergies 3 after remove', function (done) { var itself = this; entry.get(context.dbinfo, 'testallergies', 'pat0', allergiesIds[3], options, function (err, entry) { if (err) { done(err); } else { expect(entry.archived_on).to.exist; expect(entry.data).to.deep.equal(allergySamples[2]); expect(entry.archived).to.equal(true); common.verifyMoment.call(itself, momentBeforeDelete, entry.archived_on.toISOString()); done(); } }); }); it('entry.replace testallergies 7 for pat1', function (done) { var itself = this; var sampleClone = _.cloneDeep(allergySamples[6]); var momentBefore = moment(); entry.replace(context.dbinfo, 'testallergies', 'pat1', allergiesIds[7], sourceIds[7], sampleClone, options, function (err, result) { if (err) { done(err); } else { expect(result.id).to.equal(allergiesIds[7]); expect(result.versionId).to.equal('2'); common.verifyMoment.call(itself, momentBefore, result.lastUpdated); done(); } }); }); it('entry.get testallergies 7 after replace', function (done) { entry.get(context.dbinfo, 'testallergies', 'pat1', allergiesIds[7], options, function (err, entry) { if (err) { done(err); } else { expect(entry.data).to.deep.equal(allergySamples[6]); done(); } }); }); it('entry.remove testallergies 7', function (done) { momentBeforeDelete = moment(); entry.remove(context.dbinfo, 'testallergies', 'pat1', allergiesIds[7], done); }); it('entry.idToPatientKey removed testallergies 7', function (done) { entry.idToPatientKey(context.dbinfo, 'testallergies', allergiesIds[7], function (err, result) { expect(err).not.to.exist; expect(result.key).to.equal('pat1'); expect(result.invalid).to.be.false; expect(result.archived).to.be.true; done(); }); }, self); it('entry.get testallergies 7 after remove', function (done) { var itself = this; entry.get(context.dbinfo, 'testallergies', 'pat1', allergiesIds[7], options, function (err, entry) { if (err) { done(err); } else { expect(entry.archived_on).to.exist; expect(entry.data).to.deep.equal(allergySamples[6]); expect(entry.archived).to.equal(true); common.verifyMoment.call(itself, momentBeforeDelete, entry.archived_on.toISOString()); done(); } }); }); xit('search.search testallergies', function (done) { var expectedPat0 = refmodel.createTestSection('testallergies', '0.0', 4); var expectedPat1 = refmodel.createTestSection('testallergies', '1.0', 4); var expected = expectedPat0.concat(expectedPat1); var searchSpec = { section: 'testallergies', query: {}, patientInfo: false }; search.search(context.dbinfo, searchSpec, function (err, result) { result = result.map(function (entry) { return entry.data; }); expect(expected).to.deep.include.members(result); expect(result).to.deep.include.members(expected); done(); }); }); var procedures = {}; xit('search.search testprocedures', function (done) { var expectedPat0 = refmodel.createTestSection('testprocedures', '0.0', 6); var expectedPat1 = refmodel.createTestSection('testprocedures', '1.0', 6); var expected = expectedPat0.concat(expectedPat1); var searchSpec = { section: 'testprocedures', query: {}, patientInfo: false }; search.search(context.dbinfo, searchSpec, function (err, result) { result = result.map(function (entry) { procedures[entry._id] = entry.data; return entry.data; }); expect(expected).to.deep.include.members(result); expect(result).to.deep.include.members(expected); done(); }); }); after(function (done) { context.dbinfo.db.dropDatabase(function (err) { if (err) { done(err); } else { context.dbinfo.connection.close(function (err) { done(err); }); } }); }); });
constructor(exp, positions=false) { this.exp = exp; this.class_colors = d3.scale.category10().domain(range(2)) this.positions = positions; }
var amqp = require('amqp'); var _ = require('lodash'); var async = require('async'); async.eachLimit(_.range(10000), 500, function iterator (i, callback){ var connection = amqp.createConnection({host: 'localhost'}); var message = { date: +new Date(), i: i }; connection.on('ready', function(){ connection.exchange( 'topic_logs', {type: 'topic', autoDelete: false}, function(exchange){ exchange.publish('roomId1', JSON.stringify(message)); console.log("Sent message : " + message); }); callback(); }); }, function done (err) { console.log('Done! : ' + err); });
module.exports = function () { const DEFAULT_SECTIONS = []; const id = (function (start) { var __start = start; return function () { return __start++; }; })(1); function assignIds(array) { return array.map(function (element) { return Object.assign({}, element, { id: id(), children: element.children.map(function (child) { return Object.assign({}, child, {id: id()}); }) }); }); } function assignDefaultSections(array) { return array.map(function (element) { return Object.assign({}, element, { sections: element.sections ? element.sections : DEFAULT_SECTIONS, children: element.children.map(function (child) { return Object.assign({}, child, { sections: child.sections ? child.sections : DEFAULT_SECTIONS, }); }) }); }); } function flatten(tree) { return lodash.flatten(tree.map(function (leaf) { return [leaf].concat(leaf.children); })); } const categories = assignDefaultSections(assignIds([ {title: 'Accommodation', children: [ {title: 'Hotels', sections: lodash.range(1, 11)}, {title: 'Vacation Rentals'}, {title: 'B&B'}, {title: 'Camping & Hostels'}, {title: 'Travel'}, {title: 'Rio'}]}, {title: 'Business', children: [ {title: 'Consulting & Coaching'}, {title: 'Services & Maintenance'}, {title: 'Advertising & Marketing'}, {title: 'Automotive & Cars'}, {title: 'Real Estate'}, {title: 'Finance & Law'}, {title: 'Technology & Apps'}, {title: 'Pets & Animals'}]}, {title: 'Online Store', children: [ {title: 'Clothing & Accessories'}, {title: 'Health & Beauty'}, {title: 'Home & Electronics'}]}, {title: 'Photography', children: [ {title: 'Events & Portraits'}, {title: 'Commercial & Editorial'}, {title: 'Travel & Documentary'}]}, {title: 'Music', children: [ {title: 'Solo Artist'}, {title: 'Band'}, {title: 'DJ'}, {title: 'Music Industry'}]}, {title: 'Design', children: [ {title: 'Designer'}, {title: 'Agency'}, {title: 'Portfolio'}]}, {title: 'Restaurants & Food', children: [ {title: 'Restaurant'}, {title: 'Cafe & Bakery'}, {title: 'Bar & Club'}, {title: 'Catering & Chef'}, {title: 'Food & Drinks'}]}, {title: 'Events', children: [ {title: 'Weddings & Celebrations'}, {title: 'Event Production'}, {title: 'Performance & Shows'}, {title: 'Parties & Festivals'}]}, {title: 'Portfolio & CV', children: [ {title: 'Portfolios'}, {title: 'Resumes & CVs'}, {title: 'Personal'}]}, {title: 'Blog', children: []}, {title: 'Health & Wellness', children: [ {title: 'Health'}, {title: 'Wellness'}, {title: 'Sport & Recreation'}]}, {title: 'Fashion & Beauty', children: [ {title: 'Hair & Beauty'}, {title: 'Fashion & Accessories'}]}, {title: 'Community & Education', children: [ {title: 'Community'}, {title: 'Education'}, {title: 'Religion & Non Profit'}]}, {title: 'Creative Arts', children: [ {title: 'Painters & Illustrators'}, {title: 'Performing Arts'}, {title: 'Writers'}, {title: 'Entertainment'}]}, {title: 'Landing Pages', children: [ {title: 'Coming Soon'}, {title: 'Launch'}, {title: 'Campaign'}]} ])); return { findCategories: function () { return categories; }, findSectionIds: function (categoryIds) { const sections = flatten(categories) .filter(function (category) { return lodash.contains(categoryIds, category.id); }) .map(function (category) { return category.sections; }); return lodash(sections).flatten().unique().value(); } }; };