COLLECTED BY
Organization:
Internet Archive
Focused crawls are collections of frequently-updated webcrawl data from narrow (as opposed to broad or wide) web crawls, often focused on a single domain or subdomain.
The Wayback Machine - https://web.archive.org/web/20201220222014/https://github.com/lodash/lodash/blob/master/property.js
Permalink
Cannot retrieve contributors at this time
30 lines (28 sloc)
784 Bytes
import baseProperty from './.internal/baseProperty.js'
import basePropertyDeep from './.internal/basePropertyDeep.js'
import isKey from './.internal/isKey.js'
import toKey from './.internal/toKey.js'
/**
* Creates a function that returns the value at `path` of a given object.
*
* @since 2.4.0
* @category Util
* @param {Array|string } path The path of the property to get.
* @returns {Function } Returns the new accessor function.
* @example
*
* const objects = [
* { 'a': { 'b': 2 } },
* { 'a': { 'b': 1 } }
* ]
*
* map(objects, property('a.b'))
* // => [2, 1]
*
* map(sortBy(objects, property(['a', 'b'])), 'a.b')
* // => [1, 2]
*/
function property ( path ) {
return isKey ( path ) ? baseProperty ( toKey ( path ) ) : basePropertyDeep ( path )
}
export default property
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.