FCF 2.0 development in progress...
> > > >
[News] [Packages API] [Downloads] [Donate to the project] [Contacts]

fcf.get() function

mixed fcf.get(object a_object, mixed a_key)

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 Map and Set objects


object a_object
- Source object

mixed a_key
- Source key
- Returns the element stored in the object,

If the element is not found in the object, undefined is returned

If a_object is not an object, undefined is returned

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")); }


"k1" from {k1: "v1"}: v1 0 from ["v1"]: v1 "k1" from Map({k1: "v1"}): v1 "k1" from Set(["k1"]): k1