Skip to content

Instantly share code, notes, and snippets.

😻
Coding

Oliver THEBAULT Oliboy50

😻
Coding
Block or report user

Report or block Oliboy50

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Oliboy50
Oliboy50 / multiGet.js
Last active May 8, 2018
Lodash multi get (with `[]` path syntax)
View multiGet.js
const _ = require('lodash');
function multiGet(object, path, defaultValue) {
return path
.split('[]')
.reduce((resolvedPaths, pathShard, pathShardIndex, pathShards) => {
const isFirstPathShard = pathShardIndex === 0;
const isLastPathShard = pathShardIndex === pathShards.length -1;
return resolvedPaths
.map(resolvedPath => {
View gist:299b897b28a92949b8d0
I am the Miaou user with id 103 and name "Oliboy50" on http://dystroy.org/miaou
You can’t perform that action at this time.