school.school.forEach(function(data, i) { if(!obj[data.province]) { obj[data.province] = [] } obj[data.province].push(data.name) })
ImportDeclaration( path ) { // If `translate` from `i18n-calypso` is imported with an // alias, set the specified alias as a reference to translate. if ( 'i18n-calypso' !== path.node.source.value ) { return; } path.node.specifiers.forEach( ( specifier ) => { if ( specifier.imported && 'translate' === specifier.imported.name && specifier.local ) { functions[ specifier.local.name ] = functions.translate; } } ); }
mapBlocksRecursively( blocks, function modifyBlocksForSelection( block ) { // Ensure that core/button doesn't link to external template site if ( 'core/button' === block.name && undefined !== block.attributes.url ) { block.attributes.url = '#'; } return block; } )
describe( 'wpcom.site.get', function () { it( 'should require site data', ( done ) => { site .get() .then( ( data ) => { assert.equal( 'number', typeof data.ID ); assert.equal( 'string', typeof data.name ); done(); } ) .catch( done ); } ); } );
createSchemaIfNotExists(schemaName) { return this.query( 'PRAGMA database_list' ).then((schemas) => { if (!schemas.find(s => s.name === schemaName)) { return this.query(`ATTACH DATABASE ${schemaName} AS ${schemaName}`); } return null; }); }
/** * This is a simple member function. * * It should be inherited by all subclasses. This class has a static * member with the same name, both should be documented. * * @returns Return the name. */ public getName(): string { return this.name; }
constructor(query, measure) { this.query = query; if (measure.expression) { this.expression = measure.expression; this.expressionCubeName = measure.cubeName; this.expressionName = `${measure.cubeName}.${measure.name}`; } this.measure = measure; }
const House = ({ children, ...props }) => ( <div class="card"> <h3 class="card-header">{props.house.name}</h3> <div class="card-body"> <EditHouse {...props} /> </div> </div> )
it('should change chat title', function (done){ var title = 'test-chat-title-' + Date.now(); listen(done, function (msg) { return msg.type === 'event' && msg.logMessageType === 'log:thread-name' && msg.logMessageData.name === title; }); groupChatName = title; api.setTitle(title, groupChatID, checkErr(done)); });
handleTorrentProcessed(nextTorrentDetails) { const prevTorrentDetails = this.torrentListSummary.torrents[nextTorrentDetails.hash]; if (hasTorrentFinished(prevTorrentDetails, nextTorrentDetails)) { this.services.notificationService.addNotification({ id: 'notification.torrent.finished', data: {name: nextTorrentDetails.name}, }); } }
it('should parse share attachment correctly', function () { var formatted = formatDeltaMessage(shareAttachmentFixture); assert(formatted.attachments[0].type === "share"); assert(formatted.attachments[0].title === "search engines"); assert(formatted.attachments[0].target.items[0].name === "search engines"); assert(formatted.attachments[0].target.items[0].call_to_actions.length === 3); assert(formatted.attachments[0].target.items[0].call_to_actions[0].title === "Google"); });
const pickSampleValues = (databaseConnection, collectionName, field) => databaseConnection.collection(collectionName) .aggregate([ { $match: { [field.name]: { $ne: null } } }, { $sample: { size: SAMPLE_COUNT_TO_FETCH } }, { $project: { _id: false, value: `$${field.name}` } }, ]) .toArray() .then((samples) => _.map(samples, 'value'))
/** * Returns the name. See [[BaseClass.name]]. * * @returns The return value. */ public get nameProperty(): string { return this.name; }
const House = ({ children, ...props }) => ( <div class="card"> <h3 class="card-header">{props.house.name}</h3> <div class="card-body"> <EditHouse {...props} /> </div> </div> )