fcf.get() function
Package: fcf-framework-core
File: fcf-framework-core:fcf.js
Available from version: 2.0.2
Get an element stored in an object by key. Also performed for
Arguments
- Source object
- Source key
Result
- Returns the element stored in the object,
If the element is not found in the object,
If
Example: Function application
console.warn(`"k1" from {k1: "v1"}: `, fcf.get({k1: "v1"}, "k1"));
console.warn(`0 from ["v1"]: `, fcf.get(["v1"], 0));
{
let map = new Map();
map.set("k1", "v1");
console.warn(`"k1" from Map({k1: "v1"}): `, fcf.get(map, "k1"));
}
{
let set = new Set();
set.add("k1");
console.warn(`"k1" from Set(["k1"]): `, fcf.get(set, "k1"));
}
Output:
"k1" from {k1: "v1"}: v1
0 from ["v1"]: v1
"k1" from Map({k1: "v1"}): v1
"k1" from Set(["k1"]): k1