Skip to content

Instantly share code, notes, and snippets.

View emilioriosvz's full-sized avatar
🍍

Emilio Rios emilioriosvz

🍍
View GitHub Profile
@emilioriosvz
emilioriosvz / getTypes.js
Last active June 29, 2017 08:33
function that receive an object and change the values by the type of the key
var o = {
'1': 'adios',
'2': 1.5,
'3': true,
'4': [1, 2, 3],
'5': {1: 2}
}
const getTypes = obj => {
return Object.keys(obj).reduce((prev, key) => {
@emilioriosvz
emilioriosvz / getAllPropertiesNames.js
Created March 14, 2016 22:12
Get all properties names of an object
var getAllProperties = function (object) {
var properties = []
do {
Object.getOwnPropertyNames(object).forEach((prop) => {
if (!~properties.indexOf(prop)) {
properties.push(prop)
}
})
} while (object = Object.getPrototypeOf(object))