UNPKG

896 BSource Map (JSON)View Raw
1{"version":3,"file":"accessor.js","sources":["../../src/accessor.js"],"sourcesContent":["/**\n @function accessor\n @desc Wraps an object key in a simple accessor function.\n @param {String} key The key to be returned from each Object passed to the function.\n @param {*} [def] A default value to be returned if the key is not present.\n @example <caption>this</caption>\naccessor(\"id\");\n @example <caption>returns this</caption>\nfunction(d) {\n return d[\"id\"];\n}\n*/\nexport default function(key, def) {\n if (def === void 0) return d => d[key];\n return d => d[key] === void 0 ? def : d[key];\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;AAYA,eAAe,SAAS,GAAG,EAAE,GAAG,EAAE;EAChC,IAAI,GAAG,KAAK,KAAK,CAAC,IAAE,iBAAO,EAAC,CAAC,SAAG,CAAC,CAAC,GAAG,IAAC,GAAC;EACvC,iBAAO,EAAC,CAAC,SAAG,CAAC,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,IAAC,CAAC;CAC9C;"}
\No newline at end of file