@polkadot/util
Advanced tools
Comparing version 0.13.1 to 0.13.2
{ | ||
"name": "@polkadot/util", | ||
"version": "0.13.1", | ||
"version": "0.13.2", | ||
"description": "A collection of useful utilities for @polkadot", | ||
@@ -32,3 +32,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@polkadot/api-jsonrpc": "^0.6.12", | ||
"@polkadot/api-jsonrpc": "^0.7.1", | ||
"@polkadot/dev": "^0.15.1" | ||
@@ -35,0 +35,0 @@ }, |
'use strict'; | ||
var _regenerator = require('babel-runtime/regenerator'); | ||
var _regenerator2 = _interopRequireDefault(_regenerator); | ||
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator'); | ||
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// Copyright 2017-2018 Jaco Greeff | ||
@@ -15,16 +25,31 @@ // This software may be modified and distributed under the terms | ||
module.exports = function syncify(promise) { | ||
var _this = this; | ||
var result = void 0; | ||
promise.catch(function (error) { | ||
return error; | ||
}).then(function (_result) { | ||
result = _result; | ||
}); | ||
(0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() { | ||
return _regenerator2.default.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.next = 2; | ||
return promise.catch(function (error) { | ||
return error; | ||
}); | ||
var ms = 0; | ||
case 2: | ||
result = _context.sent; | ||
while (isUndefined(result)) { | ||
deasync.sleep(ms++); | ||
} | ||
case 3: | ||
case 'end': | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, _this); | ||
}))(); | ||
deasync.loopWhile(function () { | ||
return isUndefined(result); | ||
}); | ||
if (isError(result)) { | ||
@@ -31,0 +56,0 @@ throw result; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125440
1224