From 65768653dd82e950d8bf2cda18d00f44d595768f Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sun, 31 Dec 2017 15:00:55 +0200 Subject: [PATCH 1/5] Update isArrayLike.md --- snippets/isArrayLike.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/snippets/isArrayLike.md b/snippets/isArrayLike.md index 2a5c9ad09..4230bd58d 100644 --- a/snippets/isArrayLike.md +++ b/snippets/isArrayLike.md @@ -1,6 +1,8 @@ ### isArrayLike -Checks if the provided argument is `arrayLike` i.e. is iterable. +Checks if the provided argument is array-like (i.e. is iterable). + +Use `Array.from()` and a `try... catch` block to check if the provided argument is array-like. ```js const arr = (arr) => { From 21d6886f8dec20dbe75174153cb1f0043f8f240f Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sun, 31 Dec 2017 15:01:34 +0200 Subject: [PATCH 2/5] Update isValidJSON.md --- snippets/isValidJSON.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/isValidJSON.md b/snippets/isValidJSON.md index af9781a23..e81748be9 100644 --- a/snippets/isValidJSON.md +++ b/snippets/isValidJSON.md @@ -1,8 +1,8 @@ ### isValidJSON -Checks if the provided argument is an valid JSON. - +Checks if the provided argument is a valid JSON. +Use `JSON.parse()` and a `try... catch` block to check if the provided argument is a valid JSON. ```js const arr = (obj) => { From edb4f46008a2706df33680dc434f75a1f41cf003 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sun, 31 Dec 2017 15:02:05 +0200 Subject: [PATCH 3/5] Update isArrayLike.md --- snippets/isArrayLike.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/isArrayLike.md b/snippets/isArrayLike.md index 4230bd58d..83c8acb81 100644 --- a/snippets/isArrayLike.md +++ b/snippets/isArrayLike.md @@ -5,7 +5,7 @@ Checks if the provided argument is array-like (i.e. is iterable). Use `Array.from()` and a `try... catch` block to check if the provided argument is array-like. ```js -const arr = (arr) => { +const isArrayLike = arr => { try{ Array.from(arr); return true; From e6c74f263c32dfc7f1bebb1228b07b481ec31d9d Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sun, 31 Dec 2017 15:02:19 +0200 Subject: [PATCH 4/5] Update isValidJSON.md --- snippets/isValidJSON.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/isValidJSON.md b/snippets/isValidJSON.md index e81748be9..2a7c91971 100644 --- a/snippets/isValidJSON.md +++ b/snippets/isValidJSON.md @@ -5,7 +5,7 @@ Checks if the provided argument is a valid JSON. Use `JSON.parse()` and a `try... catch` block to check if the provided argument is a valid JSON. ```js -const arr = (obj) => { +const isValidJSON = obj => { try{ JSON.parse(obj); return true; From 43e7c0a769894d9f580c191f77e53fa49946027a Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sun, 31 Dec 2017 15:03:54 +0200 Subject: [PATCH 5/5] Update isValidJSON.md --- snippets/isValidJSON.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/snippets/isValidJSON.md b/snippets/isValidJSON.md index 2a7c91971..56211961b 100644 --- a/snippets/isValidJSON.md +++ b/snippets/isValidJSON.md @@ -17,5 +17,6 @@ const isValidJSON = obj => { ``` ```js - +isValidJSON('{"name":"Adam","age":20}'); // true +isValidJSON('{"name":"Adam",age:"20"}'); // false ```