You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
2.5 KiB
1 line
2.5 KiB
{"ast":null,"code":"/**\n * Safe chained function\n *\n * Will only create a new function if needed,\n * otherwise will pass back existing functions or null.\n *\n * @param {function} functions to chain\n * @returns {function|null}\n */\nfunction createChainedFunction() {\n for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {\n funcs[_key] = arguments[_key];\n }\n return funcs.filter(f => f != null).reduce((acc, f) => {\n if (typeof f !== 'function') {\n throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');\n }\n if (acc === null) return f;\n return function chainedFunction() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n // @ts-ignore\n acc.apply(this, args); // @ts-ignore\n\n f.apply(this, args);\n };\n }, null);\n}\nexport default createChainedFunction;","map":{"version":3,"names":["createChainedFunction","funcs","filter","f","reduce","acc","Error","chainedFunction","args","apply"],"sources":["C:/Cours/SAE/SAE-3.01/Scripted/Scripted/website/node_modules/react-bootstrap/esm/createChainedFunction.js"],"sourcesContent":["/**\n * Safe chained function\n *\n * Will only create a new function if needed,\n * otherwise will pass back existing functions or null.\n *\n * @param {function} functions to chain\n * @returns {function|null}\n */\nfunction createChainedFunction(...funcs) {\n return funcs.filter(f => f != null).reduce((acc, f) => {\n if (typeof f !== 'function') {\n throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');\n }\n\n if (acc === null) return f;\n return function chainedFunction(...args) {\n // @ts-ignore\n acc.apply(this, args); // @ts-ignore\n\n f.apply(this, args);\n };\n }, null);\n}\n\nexport default createChainedFunction;"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,qBAAqB,GAAW;EAAA,kCAAPC,KAAK;IAALA,KAAK;EAAA;EACrC,OAAOA,KAAK,CAACC,MAAM,CAACC,CAAC,IAAIA,CAAC,IAAI,IAAI,CAAC,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEF,CAAC,KAAK;IACrD,IAAI,OAAOA,CAAC,KAAK,UAAU,EAAE;MAC3B,MAAM,IAAIG,KAAK,CAAC,yEAAyE,CAAC;IAC5F;IAEA,IAAID,GAAG,KAAK,IAAI,EAAE,OAAOF,CAAC;IAC1B,OAAO,SAASI,eAAe,GAAU;MAAA,mCAANC,IAAI;QAAJA,IAAI;MAAA;MACrC;MACAH,GAAG,CAACI,KAAK,CAAC,IAAI,EAAED,IAAI,CAAC,CAAC,CAAC;;MAEvBL,CAAC,CAACM,KAAK,CAAC,IAAI,EAAED,IAAI,CAAC;IACrB,CAAC;EACH,CAAC,EAAE,IAAI,CAAC;AACV;AAEA,eAAeR,qBAAqB"},"metadata":{},"sourceType":"module"} |