This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
const Duplicates = ({ numberList }) => { | |
let duplicates = [] | |
let uniques = [] | |
let hashMap = {} | |
numberList.forEach(element => { | |
if (hashMap[element]) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const generateCellsValues = (cells) => cells?.reduce((acc, item) => ({ | |
...acc, | |
[item?.column?.id]: item?.value | |
}), {}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
"Samsung GALAXY J6", | |
"Samsung GALAXY J8", | |
"Realme C1", | |
"Moto G4", | |
"Redmi 6A", | |
"Vivo1816", | |
"Samsung On5", | |
"Moto E5 Plus", | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let workOnChannel = async (channel) => { | |
// ... | |
//Consumer listening to the queue, which was ealier created and bind with exchange | |
let { consumerTag } = await channel.consume(queue, function (msg) { | |
if (msg.content) { | |
let dataReceive = JSON.parse(msg.content.toString()); | |
console.log(`[โ] Incomming message ${JSON.stringify(dataReceive)}`); | |
} | |
}, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let workOnChannel = async (channel) => { | |
//The channel here is a regular amqplib `ConfirmChannel`. | |
let exchange = "myFavExchangeName"; | |
await channel.assertExchange(exchange, 'fanout', { | |
durable: false | |
}); | |
let { queue } = await channel.assertQueue('', { | |
exclusive: true, | |
autoDelete: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
conn.createChannel({ | |
json: true, | |
setup: function (channel) { | |
workOnChannel(channel); | |
} | |
}); | |
let workOnChannel = async (channel) => { | |
//The channel here is a regular amqplib `ConfirmChannel`. | |
//We will perform our operations here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const amqp = require('amqp-connection-manager'); | |
require('dotenv').config(); | |
//process.env.mqConns is an array of connection string | |
let conn = amqp.connect(JSON.parse(process.env.mqConns)); | |
conn.on('connect', () => console.log('Connected!')); | |
conn.on('disconnect', err => console.log('Disconnected.', err)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": { | |
"result": { | |
"KycData": { | |
"Name": { | |
"fullName": "Test Name" | |
}, | |
"Demographics": { | |
"dateOfBirth": "28/05/1993", | |
"gender": "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var clone = function (obj) { | |
if (null == obj || "object" != typeof obj) return obj; | |
var copy = obj.constructor(); | |
for (var attr in obj) { | |
if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr]; | |
} | |
return copy; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function asyncFunction(name) { | |
await collection.find({ | |
"name": new RegExp(name, 'i') | |
}, (err, res) => { | |
if(err) | |
console.log("Error:",err); | |
else { | |
async.map(res, (item, callback)=>{ | |
anotherCollection.findById(item.id, (err, res)=>{ | |
if(err) |
NewerOlder