@bothrs/util
Advanced tools
Comparing version 1.17.0 to 1.18.0
export function timeout(ms: number) { | ||
return new Promise(resolve => setTimeout(resolve, ms)) | ||
} | ||
export function isPending(promise) { | ||
const test = {} | ||
return Promise.race([promise, test]).then( | ||
value => value === test, | ||
() => false | ||
) | ||
} |
@@ -23,3 +23,7 @@ export function fetchJSON(url: string, options?: any) { | ||
) | ||
).then(r => r.json()) | ||
) | ||
.then(r => r.json()) | ||
.catch(e => { | ||
throw new Error('Failed to fetch JSON: ' + e.message) | ||
}) | ||
} | ||
@@ -26,0 +30,0 @@ |
@@ -11,3 +11,7 @@ // DB_CONNECTION=mysql | ||
const parsed = Object.assign({}, process.env, require('dotenv/lib/main').config().parsed) | ||
const parsed = Object.assign( | ||
{}, | ||
process.env, | ||
require('dotenv/lib/main').config().parsed | ||
) | ||
@@ -14,0 +18,0 @@ const config = { |
{ | ||
"name": "@bothrs/util", | ||
"version": "1.17.0", | ||
"version": "1.18.0", | ||
"description": "Common helper functions", | ||
@@ -9,4 +9,4 @@ "license": "MIT", | ||
"dev": "yarn lint", | ||
"fix": "prettier --write -l *.mjs *.ts", | ||
"lint": "prettier -l *.mjs *.ts", | ||
"fix": "prettier --write -l *.js *.mjs *.ts", | ||
"lint": "prettier -l *.js *.mjs *.ts", | ||
"tsc": "tsc -w --noEmit", | ||
@@ -13,0 +13,0 @@ "prepare": "yarn fix", |
@@ -15,4 +15,4 @@ import Player from '@vimeo/player' | ||
data = await getJSON('https://vimeo.com/api/oembed.json?url=' + link) | ||
} catch(e) { | ||
console.error('Error fetching metadata',link, e) | ||
} catch (e) { | ||
console.error('Error fetching metadata', link, e) | ||
} | ||
@@ -19,0 +19,0 @@ return data |
Sorry, the diff of this file is not supported yet
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
65201
69
2280