Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
_.mergeWith example
node v6.17.1
version:
master
endpoint
share
tweet
var _ = require("lodash@4.16.4"); _.assign(global, require("lodash-doc-globals")); Object.observe = _.noop;
var a = { "rewrite": [ { "from": "/css/*", "to": "/build/styles/$1" }, { "from": "/npm/*", "to": "http://registry.npmjs.org/$1" }, { "from": "/:user/repos/:name", "to": "https://api.github.com/repos/:user/:name" } ] } var b = { "rewrite": [ { from: '/another', to: '/lib/another' } ] } function customiser(objValue, srcValue) { if (_.isArray(objValue)) { return objValue.concat(srcValue); } } _.mergeWith(a, b, customiser);
Created from: https://lodash.com/docs/4.16.4#merge
Loading…
no comments
sign in
to comment