From 5eaacd506e48c7cc87d3d02905269f30df2c9f4f Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sat, 16 Dec 2017 14:39:08 +0200 Subject: [PATCH] Tag and build --- README.md | 12 ++++++++++++ snippets/log-function-name.md | 8 ++++++++ snippets/log-method-name.md | 8 -------- tag_database | 1 + 4 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 snippets/log-function-name.md delete mode 100644 snippets/log-method-name.md diff --git a/README.md b/README.md index 2304d2f04..babf49a07 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ * [Chain asynchronous functions](#chain-asynchronous-functions) * [Compose functions](#compose-functions) * [Curry](#curry) +* [Log function name](#log-function-name) * [Pipe functions](#pipe-functions) * [Promisify](#promisify) * [Run promises in series](#run-promises-in-series) @@ -743,6 +744,17 @@ const curry = (fn, arity = fn.length, ...args) => [⬆ back to top](#table-of-contents) +### Log function name + +Use `console.debug()` and the `name` property of the passed method to log the method's name to the `debug` channel of the console. + +```js +const functionName = fn => (console.debug(fn.name), fn); +// functionName(Math.max) -> max (logged in debug channel of console) +``` + +[⬆ back to top](#table-of-contents) + ### Pipe functions Use `Array.reduce()` with the spread operator (`...`) to perform left-to-right function composition. diff --git a/snippets/log-function-name.md b/snippets/log-function-name.md new file mode 100644 index 000000000..b449331f8 --- /dev/null +++ b/snippets/log-function-name.md @@ -0,0 +1,8 @@ +### Log function name + +Use `console.debug()` and the `name` property of the passed method to log the method's name to the `debug` channel of the console. + +```js +const functionName = fn => (console.debug(fn.name), fn); +// functionName(Math.max) -> max (logged in debug channel of console) +``` diff --git a/snippets/log-method-name.md b/snippets/log-method-name.md deleted file mode 100644 index d8922ee62..000000000 --- a/snippets/log-method-name.md +++ /dev/null @@ -1,8 +0,0 @@ -### Log method name - -Use `console.debug()` and the `name` property of the passed method to log the method's name to the `debug` channel of the console. - -```js -const methodName = fn => (console.debug(fn.name), fn); -// methodName(methodName) -> methodName (logged in debug channel of console) -``` diff --git a/tag_database b/tag_database index bd508483b..3999b7f30 100644 --- a/tag_database +++ b/tag_database @@ -56,6 +56,7 @@ is-string:utility is-symbol:utility JSON-to-date:utility last-of-list:array +log-function-name:function measure-time-taken-by-function:utility median-of-array-of-numbers:array nth-element-of-array:array