Skip to content

Instantly share code, notes, and snippets.

@julienetie
julienetie / get-events.js
Last active May 16, 2021 12:03 — forked from galpx/getEvents.js
Gets a list of all events in the browser
const isEvent0 = prop => 0 === prop.indexOf('on');
const getEventNames0 = (obj) => {
const result = [];
for (let prop in obj) {
if (!isEvent0(prop)) continue;
prop = prop.substr(2), result.push(prop);
}
return result;
}

Thoughts on Redux vs. Baobab

I'm going to write down my thoughts on these two libraries that I'm conflicted between.

Preface

Redux is a simplified Flux, with a small footprint, and an architecture that encourages writing your business logic as pure functions. In Redux views call action creators, action creators kick off side effects and further actions, actions are caught by reducers which return an updated state blob (scoped by branches of the state tree).

@julienetie
julienetie / flatten.js
Created October 9, 2016 21:12 — forked from slidenerd/flatten.js
Inspired from gdibble
function flattenObject(ob) {
let toReturn = {};
let flatObject;
for (let i in ob) {
console.log(i+ ' ' + typeof(ob[i]));
if (!ob.hasOwnProperty(i)) {
continue;
}
//Exclude arrays from the final result
//Check this http://stackoverflow.com/questions/4775722/check-if-object-is-array