mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Simplify deep path doc examples. [ci skip]
This commit is contained in:
30
lodash.js
30
lodash.js
@@ -12092,16 +12092,16 @@
|
||||
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
||||
* @example
|
||||
*
|
||||
* var object = { 'a': { 'b': { 'c': 3 } } };
|
||||
* var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });
|
||||
* var object = { 'a': { 'b': 2 } };
|
||||
* var other = _.create({ 'a': _.create({ 'b': 2 }) });
|
||||
*
|
||||
* _.has(object, 'a');
|
||||
* // => true
|
||||
*
|
||||
* _.has(object, 'a.b.c');
|
||||
* _.has(object, 'a.b');
|
||||
* // => true
|
||||
*
|
||||
* _.has(object, ['a', 'b', 'c']);
|
||||
* _.has(object, ['a', 'b']);
|
||||
* // => true
|
||||
*
|
||||
* _.has(other, 'a');
|
||||
@@ -12123,15 +12123,15 @@
|
||||
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
||||
* @example
|
||||
*
|
||||
* var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });
|
||||
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
|
||||
*
|
||||
* _.hasIn(object, 'a');
|
||||
* // => true
|
||||
*
|
||||
* _.hasIn(object, 'a.b.c');
|
||||
* _.hasIn(object, 'a.b');
|
||||
* // => true
|
||||
*
|
||||
* _.hasIn(object, ['a', 'b', 'c']);
|
||||
* _.hasIn(object, ['a', 'b']);
|
||||
* // => true
|
||||
*
|
||||
* _.hasIn(object, 'b');
|
||||
@@ -14527,14 +14527,14 @@
|
||||
* @example
|
||||
*
|
||||
* var objects = [
|
||||
* { 'a': { 'b': { 'c': _.constant(2) } } },
|
||||
* { 'a': { 'b': { 'c': _.constant(1) } } }
|
||||
* { 'a': { 'b': _.constant(2) } },
|
||||
* { 'a': { 'b': _.constant(1) } }
|
||||
* ];
|
||||
*
|
||||
* _.map(objects, _.method('a.b.c'));
|
||||
* _.map(objects, _.method('a.b'));
|
||||
* // => [2, 1]
|
||||
*
|
||||
* _.map(objects, _.method(['a', 'b', 'c']));
|
||||
* _.map(objects, _.method(['a', 'b']));
|
||||
* // => [2, 1]
|
||||
*/
|
||||
var method = rest(function(path, args) {
|
||||
@@ -14787,14 +14787,14 @@
|
||||
* @example
|
||||
*
|
||||
* var objects = [
|
||||
* { 'a': { 'b': { 'c': 2 } } },
|
||||
* { 'a': { 'b': { 'c': 1 } } }
|
||||
* { 'a': { 'b': 2 } },
|
||||
* { 'a': { 'b': 1 } }
|
||||
* ];
|
||||
*
|
||||
* _.map(objects, _.property('a.b.c'));
|
||||
* _.map(objects, _.property('a.b'));
|
||||
* // => [2, 1]
|
||||
*
|
||||
* _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
|
||||
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
|
||||
* // => [1, 2]
|
||||
*/
|
||||
function property(path) {
|
||||
|
||||
Reference in New Issue
Block a user