From 9edc65bd34dd228f427dc873969a22be28d3b5be Mon Sep 17 00:00:00 2001 From: Ido Lev Date: Sat, 15 Sep 2018 15:07:37 +0300 Subject: [PATCH 1/2] update readme --- README.md | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2172848..2dde95f 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,24 @@ Retrieve password for user const retriever = require('@iiddoo/aim-password-retrieve'); - const pwd = retriever('user'); - + // ES6 async\await + (async () => { + try { + const pwd = await retriever('user'); + } catch (error) { + // error handle + } + })(); + + // Promise + retriever('user') + .then((result) => { + const pwd = result; + }) + .catch((error) => { + // error handle + }) - Output should be `password` - ## Tests From 6d50c1623b7991e8a27f9bf35cdaafd5cc68d783 Mon Sep 17 00:00:00 2001 From: Ido Lev Date: Sat, 15 Sep 2018 15:10:04 +0300 Subject: [PATCH 2/2] update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2dde95f..29d2c47 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Retrieve password for user `npm install @iiddoo/aim-password-retrieve` ## Usage - +```javascript const retriever = require('@iiddoo/aim-password-retrieve'); // ES6 async\await @@ -30,7 +30,7 @@ Retrieve password for user .catch((error) => { // error handle }) - +``` ## Tests