MCPcopy Index your code
hub / github.com/danmactough/node-feedparser / get

Function get

lib/utils.js:23–38  ·  view source on GitHub ↗

* lodash.get, but wrapped to provide a default subkey (a/k/a path) of "#" * and defaultValue of "null" * * var obj = { '#': 'foo', 'bar': 'baz' }; * * get(obj); * // => 'foo' * * get(obj, 'bar'); * // => 'baz' * * @param {Object} obj * @param {string} [subkey="#"] By default, use the '#'

(obj, subkey, defaultValue)

Source from the content-addressed store, hash-verified

21 * @private
22 */
23function get (obj, subkey, defaultValue) {
24 if (!subkey) {
25 subkey = '#';
26 }
27
28 if (!defaultValue) {
29 defaultValue = null;
30 }
31
32 if (Array.isArray(obj)) {
33 return _get(obj[0], subkey, defaultValue);
34 }
35 else {
36 return _get(obj, subkey, defaultValue);
37 }
38}
39
40/**
41 * Safely trim a value if it's a String

Callers 1

mayHaveEmbeddedHtmlFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected