Skip to content

Instantly share code, notes, and snippets.

View syeo66's full-sized avatar

Red Ochsenbein syeo66

View GitHub Profile
@syeo66
syeo66 / functional-sort.js
Created April 24, 2019 19:34
Functional Javascript sorting.
const myArray = [0, 3, 6, 1, 2, 5, 4, 8, 7, 9];
const sortedArray = myArray.slice().sort();
@syeo66
syeo66 / sort-old.js
Last active April 24, 2019 19:38
Normal Javascript sort() useage
const myArray = [0, 3, 6, 1, 2, 5, 4, 8, 7, 9];
const sortedArray = myArray.sort();
@syeo66
syeo66 / map-mutate-2.js
Created April 23, 2019 16:44
Using .map() to mutate object properties new
const result = objects.map(obj => ({
...obj,
slug: `${obj.firstname}-${obj.name}`.toLowerCase()
}));
@syeo66
syeo66 / map-mutate.js
Last active April 23, 2019 16:33
Using .map() to mutate object properties
const objects = [
{id: 10, name: "Doe", firstname: "John", slug: "john"},
{id: 20, name: "Doe", firstname: "Jane", slug: "jane"},
{id: 30, name: "Mitchell", firstname: "John", slug: "john"},
{id: 40, name: "Money", firstname: "Boy", slug: "boy"}
];
const result = objects.map(obj => {
obj.slug = `${obj.firstname}-${obj.name}`.toLowerCase()
return obj;

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@syeo66
syeo66 / gist:e0814142b4cad06993c3fcaf9d473d60
Last active September 19, 2017 05:45
uPort 2oydFbt34ChbmtXbHTMTEF1ybGbMkn61VoL
0xe398ef543be6c96239178eab1fab92743ad71061
0x5AB8Afed2F54D66Ee38EbE2a4A78dC954e684e4E