summaryrefslogtreecommitdiff
path: root/build-es/internal/consoleFunc.js
diff options
context:
space:
mode:
Diffstat (limited to 'build-es/internal/consoleFunc.js')
-rw-r--r--build-es/internal/consoleFunc.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/build-es/internal/consoleFunc.js b/build-es/internal/consoleFunc.js
new file mode 100644
index 0000000..d56a7bd
--- /dev/null
+++ b/build-es/internal/consoleFunc.js
@@ -0,0 +1,23 @@
+'use strict';
+
+import arrayEach from 'lodash-es/_arrayEach';
+import rest from 'lodash-es/rest';
+
+export default function consoleFunc(name) {
+ return rest(function (fn, args) {
+ fn.apply(null, args.concat([rest(function (err, args) {
+ if (typeof console === 'object') {
+ if (err) {
+ if (console.error) {
+ console.error(err);
+ }
+ }
+ else if (console[name]) {
+ arrayEach(args, function (x) {
+ console[name](x);
+ });
+ }
+ }
+ })]));
+ });
+}