Skip to content

Instantly share code, notes, and snippets.

View behnamazimi's full-sized avatar

Behnam behnamazimi

View GitHub Profile
function partition(inputArray, callback) {
const result = {};
for (const [indexOfValue, value] of inputArray.entries()) {
const propertyKey = callback(value, indexOfValue);
if (propertyKey === null || propertyKey === '') {
continue;
}
if (!{}.hasOwnProperty.call(result, propertyKey)) {
result[propertyKey] = [];
}
@behnamazimi
behnamazimi / plink-plonk.js
Created February 17, 2020 08:42 — forked from tomhicks/plink-plonk.js
Listen to your web pages