From 804876b063383173a241c66e9762058c1314a8b9 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 d02073c0dbff463ad230baa2e946b9f5f040795e 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 6793f32a970f49a32f4896db3189481e9b46b385 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 91cd64f8ecb78326a16aa9bbbda0bfddd9127ceb 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 ac17bdfbe6f6a702b7d9154b6bdba9ea9056a33f 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 93165014da9c724ce8af5aa78a92a8324ad86476 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.