UNPKG

dfp-lib

Version:

This project hosts the Node.JS client library for the SOAP-based DFP API at Google.

34 lines (33 loc) 1.59 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var PromiseUtils; (function (PromiseUtils) { function whileLoop(loop, condition, initialValue) { return __awaiter(this, void 0, void 0, function* () { let v = (initialValue === undefined) ? true : initialValue; condition = condition || function (v) { return v ? true : false; }; while (condition(v)) { v = yield loop(v); } return v; }); } PromiseUtils.whileLoop = whileLoop; function doWhileLoop(loop, condition, initialValue) { return __awaiter(this, void 0, void 0, function* () { let v = (initialValue === undefined) ? true : initialValue; condition = condition || function (v) { return v ? true : false; }; do { } while (condition(v = yield loop(v))); return v; }); } PromiseUtils.doWhileLoop = doWhileLoop; })(PromiseUtils = exports.PromiseUtils || (exports.PromiseUtils = {}));