How to use the property function from lodash

Find comprehensive JavaScript lodash.property code examples handpicked from public code repositorys.

10
11
12
13
14
15
16
17
18
19

if (!_.isUndefined(item) && !_.isUndefined(sort)) {
    _.forIn(sort, function (sortOrder, sortKey) {
        var itemVal, sortFn;

        itemVal = _.property(sortKey)(item);

        if(!_.isUndefined(itemVal)){
            if (itemVal instanceof ObjectId) {
                sortFn = sortObjectId(sortOrder);
fork icon83
star icon0
watch icon2

+ 5 other calls in file

6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
* var characters = [
*   { 'name': 'fred',   'age': 40 },
*   { 'name': 'barney', 'age': 36 }
* ];
*
* var getName = _.property('name');
*
* _.map(characters, getName);
* // => ['barney', 'fred']
*
fork icon73
star icon711
watch icon29

300
301
302
303
304
305
306
307
308
309
module.exports.partitionBy         = _.partitionBy;
module.exports.pick                = _.pick;
module.exports.pickBy              = _.pickBy;
module.exports.pickWhen            = _.pickWhen;
module.exports.pipeline            = _.pipeline;
module.exports.property            = _.property;
module.exports.propertyOf          = _.propertyOf;
module.exports.pull                = _.pull;
module.exports.pullAll             = _.pullAll;
module.exports.pullAllBy           = _.pullAllBy;
fork icon19
star icon122
watch icon0

+ 92 other calls in file

941
942
943
944
945
946
947
948
949
950
951
952
953
console.log(overEvery('1')); // => true


const overSome = _.overSome([Boolean, isFinite]);
console.log(overSome('1')); // => true


const property = _.property('a');
console.log(property({ 'a': 1 })); // => 1


const propertyOf = _.propertyOf({ 'a': { 'b': 2 } });
console.log(propertyOf({ 'a': { 'b': 2 } })); // => 2
fork icon0
star icon4
watch icon0

+ 15 other calls in file

Other functions in lodash

Sorted by popularity

function icon

lodash.get is the most popular function in lodash (7670 examples)