• Stars
    star
    222
  • Rank 179,123 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 11 years ago
  • Updated almost 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Lodash mixins for (deep) object accessing / manipulation.

lodash-deep

Lodash mixins for (deep) object accessing / manipulation.

Bower version NPM version Build Status Sauce Test Status Dependency Status

Version 2.x

In 2.0 most of the methods of this module where removed, because Lodash now supports their functionality natively. E.g.:

_.deepGet(object, 'father.name');
// ->
_.get(object, 'father.name');

_.deepPluck(array, 'father.name');
// ->
_.map(array, 'father.name');

Compatibility

lodash-deep is currently compatible with:

  • Node.js
  • All ES5 compatible browsers (IE9+, Chrome, Firefox, Safari etc)

Installation

Bower

  1. bower install lodash-deep
  2. Reference lodash-deep.min.js after lodash.min.js

Node.js

  1. npm install lodash
  2. npm install lodash-deep
  3. var _ = require("lodash");
    _.mixin(require("lodash-deep"));

Docs

The following mixins are included in lodash-deep:

_.deepMapValues(object, propertyPath)

Maps all values in an object tree and returns a new object with the same structure as the original.

object

Type: Object

The root object of the object tree.

callback

Type: Function

The function to be called per iteration on any non-object value in the tree.

Callback is invoked with 2 arguments: (value, path).

value the value of the current property.

path the path of the current property.

returns

Type: Object

var object = {
    level1: {
        value: 'value 1'
        level2: {
            value: 'value 2'
            level3: {
                value: 'value 3'
            }
        }
    }
};

_.deepMapValues(object, function(value, path){
    return path + ' is ' + value)
});

/** ->
 *    {
 *        level1: {
 *            value: 'level1.value is value 1'
 *            level2: {
 *                value: 'level1.level2.value is value 2'
 *                level3: {
 *                    value: 'level1.level2.level3.value is value 3'
 *                }
 *            }
 *        }
 *    };
 */

Contributing

Please use the canary branch when creating a pull request.

Contributors

More Repositories

1

node-toogoodtogo-watcher

Node.js cli tool for monitoring your favorite TooGoodToGo businesses. Docker image available.
JavaScript
363
star
2

ui-router.stateHelper

A helper module for AngularUI Router, which allows you to define your states as an object tree.
JavaScript
235
star
3

node-pm2-windows-startup

Utility to make PM2 automatically resurrect on Windows startup
JavaScript
218
star
4

angular-recursion

A service which makes it easy possible to have recursive Angular directives.
JavaScript
176
star
5

WinLess

An awesome Windows GUI for less.js
C#
132
star
6

gulp-ng-html2js

Gulp plugin for compiling the HTML files of your Angular app to Javascript.
JavaScript
112
star
7

node-start-on-windows-boot

Simple utility to enable / disable starting a program on Windows boot, by modifiying the right registry values.
JavaScript
60
star
8

jquery.tabbable

Simple utility for selecting the next / previous ':tabbable' element.
JavaScript
47
star
9

obs-scene-execute-command-script

OBS script for executing any CLI command whenever whenever a scene is activated
Lua
28
star
10

node-transip-dns-cli

Node.js cli tool for updating TransIP DNS entries, including DDNS. Docker image available.
JavaScript
21
star
11

node-onvif-ptz-cli

Node.js cli tool for controlling PTZ cameras via the ONVIF protocol. Docker image available.
JavaScript
19
star
12

angular-class

An angular service for creating classes
JavaScript
16
star
13

docker-compose-homeassistant

Docker Compose example repository based on my home server setup, which runs on a Raspberry Pi.
Shell
9
star
14

mediawiki-dia

A MediaWiki extension which renders .dia files as .svg.
PHP
2
star
15

node-ibood-watcher

Node script to check ibood.com for new products during a 'hunt'.
JavaScript
1
star
16

angular-material-multi-level-sidenav-examle

Created with StackBlitz ⚡️
TypeScript
1
star
17

meat-fan

BBQ Fan Controller design with ESPHome firmware
1
star
18

webdriverio-wait-and

JavaScript
1
star
19

marklagendijk.nl

My personal website
TypeScript
1
star
20

node-istock-balance-scraper

Scrapes your current balance from you iStock account
JavaScript
1
star