UNPKG

@anecrow/eagle-im

Version:

API of Eagle image files management software. Support client version1.11 Build35 2020-09-07

21 lines (19 loc) 526 B
/** * @example * {} => "" * {a:"a",b:[1,"B"]} => "a=a&b=1,B" * @param {Object} data */ export const paramStringify = (data = {}) => decodeURIComponent(new URLSearchParams(data)); /** * @param {Promise<Response>} promiseObj * @returns {Promise<{status:String,data:any}>} */ export const responseThenJSON = (promiseObj) => new Promise((resolve, reject) => promiseObj .then((response) => response.json()) .then((json) => resolve(json)) .catch((error) => reject(error)) );