From a68d34eaafd638a6a4cb073c1f0cf6394cfac5ee Mon Sep 17 00:00:00 2001 From: Kladdkaka Date: Sun, 17 Dec 2017 11:54:10 +0100 Subject: [PATCH 1/6] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 37b9cc767..b8307cda9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,7 +55,7 @@ Here's what you can do to help: - `i` for indexes. - `func` for function arguments. - `nums` for arrays of numbers. -- Use `_` if your function takes no arguments or if an argument inside some function (e.g. `Array.reduce()`) is not used anywhere in your code. +- Use `()` if your function takes no arguments or if an argument inside some function (e.g. `Array.reduce()`) is not used anywhere in your code. - Specify default parameters for arguments, if necessary. It is preferred to put default parameters last unless you have pretty good reason not to. - If your snippet's function takes variadic arguments, use `..args` (although in certain cases, it might be needed to use a different name). - If your snippet function's body is a single statement, omit the `return` keyword and use an expression instead. From e20190c5345c7483ae38bc32bd20542dafd50ea9 Mon Sep 17 00:00:00 2001 From: Kladdkaka Date: Sun, 17 Dec 2017 11:54:53 +0100 Subject: [PATCH 2/6] changing _ to () --- snippets/bottom-visible.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/bottom-visible.md b/snippets/bottom-visible.md index b94ac773a..797b0eb00 100644 --- a/snippets/bottom-visible.md +++ b/snippets/bottom-visible.md @@ -3,7 +3,7 @@ Use `scrollY`, `scrollHeight` and `clientHeight` to determine if the bottom of the page is visible. ```js -const bottomVisible = _ => +const bottomVisible = () => document.documentElement.clientHeight + window.scrollY >= document.documentElement.scrollHeight || document.documentElement.clientHeight; // bottomVisible() -> true ``` From 5cf046de09f8ff68b76b025e70ed2090c33d9d35 Mon Sep 17 00:00:00 2001 From: Kladdkaka Date: Sun, 17 Dec 2017 11:55:13 +0100 Subject: [PATCH 3/6] changing _ to () --- snippets/current-URL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/current-URL.md b/snippets/current-URL.md index 200cf150b..3a549d219 100644 --- a/snippets/current-URL.md +++ b/snippets/current-URL.md @@ -3,6 +3,6 @@ Use `window.location.href` to get current URL. ```js -const currentUrl = _ => window.location.href; +const currentUrl = () => window.location.href; // currentUrl() -> 'https://google.com' ``` From ffabf8d94cba2146189c6a542c677eb171ae7f29 Mon Sep 17 00:00:00 2001 From: Kladdkaka Date: Sun, 17 Dec 2017 11:55:41 +0100 Subject: [PATCH 4/6] changing _ to () --- snippets/scroll-to-top.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/scroll-to-top.md b/snippets/scroll-to-top.md index 6c82190a4..19064a5d5 100644 --- a/snippets/scroll-to-top.md +++ b/snippets/scroll-to-top.md @@ -4,7 +4,7 @@ Get distance from top using `document.documentElement.scrollTop` or `document.bo Scroll by a fraction of the distance from top. Use `window.requestAnimationFrame()` to animate the scrolling. ```js -const scrollToTop = _ => { +const scrollToTop = () => { const c = document.documentElement.scrollTop || document.body.scrollTop; if (c > 0) { window.requestAnimationFrame(scrollToTop); From 4a1989764b3b58e001c26a333b0dabf58e9c8b3f Mon Sep 17 00:00:00 2001 From: Kladdkaka Date: Sun, 17 Dec 2017 11:56:01 +0100 Subject: [PATCH 5/6] Update UUID-generator.md --- snippets/UUID-generator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/UUID-generator.md b/snippets/UUID-generator.md index 01d4e27ac..342fce12b 100644 --- a/snippets/UUID-generator.md +++ b/snippets/UUID-generator.md @@ -3,7 +3,7 @@ Use `crypto` API to generate a UUID, compliant with [RFC4122](https://www.ietf.org/rfc/rfc4122.txt) version 4. ```js -const uuid = _ => +const uuid = () => ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) ); From ffb230ebad8449c206365492c71d9cf1be903962 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sun, 17 Dec 2017 13:00:35 +0200 Subject: [PATCH 6/6] Update CONTRIBUTING.md --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b8307cda9..15aab603c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,7 +55,8 @@ Here's what you can do to help: - `i` for indexes. - `func` for function arguments. - `nums` for arrays of numbers. -- Use `()` if your function takes no arguments or if an argument inside some function (e.g. `Array.reduce()`) is not used anywhere in your code. +- Use `()` if your function takes no arguments. +- Use `_` if an argument inside some function (e.g. `Array.reduce()`) is not used anywhere in your code. - Specify default parameters for arguments, if necessary. It is preferred to put default parameters last unless you have pretty good reason not to. - If your snippet's function takes variadic arguments, use `..args` (although in certain cases, it might be needed to use a different name). - If your snippet function's body is a single statement, omit the `return` keyword and use an expression instead.