From 291803c31f829fe0d32bb3207bc11def95a7408c Mon Sep 17 00:00:00 2001 From: Nevena Bojovic Date: Tue, 1 Mar 2022 20:05:50 +0100 Subject: Urađena test aplikacija. Povezan front i back. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Front/node_modules/inquirer/lib/utils/utils.js | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 sandbox/testAppNevena/Front/node_modules/inquirer/lib/utils/utils.js (limited to 'sandbox/testAppNevena/Front/node_modules/inquirer/lib/utils/utils.js') diff --git a/sandbox/testAppNevena/Front/node_modules/inquirer/lib/utils/utils.js b/sandbox/testAppNevena/Front/node_modules/inquirer/lib/utils/utils.js new file mode 100644 index 00000000..92117510 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/inquirer/lib/utils/utils.js @@ -0,0 +1,28 @@ +'use strict'; +const _ = { + isFunction: require('lodash/isFunction'), +}; +const { from, of } = require('rxjs'); +const runAsync = require('run-async'); + +/** + * Resolve a question property value if it is passed as a function. + * This method will overwrite the property on the question object with the received value. + * @param {Object} question - Question object + * @param {String} prop - Property to fetch name + * @param {Object} answers - Answers object + * @return {Rx.Observable} - Observable emitting once value is known + */ + +exports.fetchAsyncQuestionProperty = function (question, prop, answers) { + if (!_.isFunction(question[prop])) { + return of(question); + } + + return from( + runAsync(question[prop])(answers).then((value) => { + question[prop] = value; + return question; + }) + ); +}; -- cgit v1.2.3