Guangning Yu's Blog
Home
Code
Data
Setup
Industry
MachineLearning
Archive
Lodash Basics
2019-02-17 01:40:29
- loop through object ``` > var _ = require('lodash'); > foo { a: { num: 1 }, b: { num: 2 }, c: { num: 3 } } > _.forEach(foo, (vlu, key) => {console.log(vlu, key);}) { num: 1 } 'a' { num: 2 } 'b' { num: 3 } 'c' { a: { num: 1 }, b: { num: 2 }, c: { num: 3 } } ``` - filter object of objects ``` > foo { a: { num: 1 }, b: { num: 2 }, c: { num: 3 } } > _.pickBy(foo, (i) => i.num>=2) { b: { num: 2 }, c: { num: 3 } } ```
Previous:
Plot decay function
Next:
Setup Nginx on Ubuntu 14.04