From 57ea45c10e5563355e389fa19b62ef7e08422a52 Mon Sep 17 00:00:00 2001 From: Rohit Tanwar <31792358+kriadmin@users.noreply.github.com> Date: Wed, 3 Jan 2018 16:47:19 +0530 Subject: [PATCH] Create pluralize.md --- snippets/pluralize.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 snippets/pluralize.md diff --git a/snippets/pluralize.md b/snippets/pluralize.md new file mode 100644 index 000000000..396bedc25 --- /dev/null +++ b/snippets/pluralize.md @@ -0,0 +1,10 @@ +# pluralize + +Checks if the provided `num` is + +``` js +const pluralize = (num, item, items) => ( + num > 0 ? throw new Error(`num takes value greater than equal to 1. Value povided was ${num} `) + num === 1 ? item : items +) +```