//sort by imported name importNames.sort( ( a, b ) => { if ( a.imported < b.imported ) { return -1; } if ( a.imported > b.imported ) { return 1; } return 0; } );
classify(terms) { const tfidfs = this.tfidfs(terms); const result = []; Object.keys(tfidfs).forEach((key) => { result.push({ document: key, score: tfidfs[key] }); }); return result.sort((a, b) => b.score - a.score); }
[associationA, associationB] .sort((a, b) => { if (a.collection === b.collection) { if (a.dominant) return 1; else return -1; } return a.collection < b.collection ? -1 : 1; }) .map(table => _.snakeCase(`${pluralize.plural(table.collection)} ${pluralize.plural(table.via)}`) ) .join('__')
it('updates the list of brokers', async () => { expect(brokerPool.brokers).toEqual({}) await brokerPool.refreshMetadata([topicName]) expect(Object.keys(brokerPool.brokers).sort()).toEqual(['0', '1', '2']) expect(Object.values(brokerPool.brokers)).toEqual( expect.arrayContaining([expect.any(Broker), expect.any(Broker), expect.any(Broker)]) ) })
async run() { const result = []; for (let i = 0; i < this.algorithms.length; i += 1) { const value = await this.measure(this.algorithms[i]); result.push(value); } return result.sort( (a, b) => b.transactionsPerSecond - a.transactionsPerSecond ); }
const cleanupEntities = function(luisObject) { let consolidatedList = []; luisObject.composites.forEach(item => consolidatedList.push(item)); luisObject.closedLists.forEach(item => consolidatedList.push(item)); luisObject.regex_entities.forEach(item => consolidatedList.push(item)); luisObject.prebuiltEntities.forEach(item => consolidatedList.push(item)); let idxToRemove = []; luisObject.entities.forEach((item, idx) => { if (consolidatedList.find(e => e.name == item.name) !== undefined) idxToRemove.push(idx); }) idxToRemove.sort((a, b) => a-b).forEach(idx => luisObject.entities.splice(idx, 1)) }
const decode = async rawData => { const decoder = new Decoder(rawData) return { topicErrors: decoder.readArray(topicErrors).sort(topicNameComparator), } }
var projectGraph = function ( root, sortObjects ) { _objectCount = 0; _renderData.objects.length = 0; _renderData.lights.length = 0; projectObject( root ); if ( sortObjects === true ) { _renderData.objects.sort( painterSort ); } }
generatePartitionsPerSubscribedTopic() { const map = new Map() for (const topic of this.topicsSubscribed) { const partitions = this.cluster .findTopicPartitionMetadata(topic) .map(m => m.partitionId) .sort() map.set(topic, partitions) } return map }
function stringify(value) { function stabilize(key, object) { if (typeof object !== 'object' || object === undefined || object === null) return object; const result = {}; for (const key of Object.keys(object).sort()) result[key] = object[key]; return result; } return JSON.stringify(stabilize(null, value), stabilize); }
vectorToClassifications(vector) { const obj = this.outputLookup.vectorToObj(vector); const result = []; Object.keys(obj).forEach((key) => { result.push({ intent: key, score: obj[key] }); }); return result.sort((a, b) => b.score - a.score); }
function getValidCodemodNames() { return [ ...getLocalCodemodFileNames(), ...Object.getOwnPropertyNames( config.codemodArgs ) ] .map( ( name ) => '- ' + name ) .sort(); }
private sortProperty(arrayToSort: any[], propertyToSort: string) { (arrayToSort || []).sort((a: any, b: any) => { const aValue = a[propertyToSort].toLowerCase() const bValue = b[propertyToSort].toLowerCase() return aValue < bValue ? -1 : aValue > bValue ? 1 : 0 }) }
Object.keys(oauth_parameters) .sort() .map(function(key) { var value = oauth_parameters[key]; return key + '="' + value + '"'; }) .join(', ')
//sort by imported name importNames.sort( ( a, b ) => { if ( a.imported < b.imported ) { return -1; } if ( a.imported > b.imported ) { return 1; } return 0; } );