1/** 2 * Converts a string in blurhash format (`blurhash:/<hash>/<width>/<height>` 3 * or <hash>/<width>/<height>) into an `ImageSource`. 4 * Note: The blurhash:/ uri scheme is removed, because for backward compatibility reasons, 5 * strings without a scheme are assumed to be `blurhash` by default. 6 * 7 * @return An ImageSource representing the provided blurhash. 8 * */ 9export function resolveBlurhashString(str) { 10 const [blurhash, width, height] = str.replace(/^blurhash:\//, '').split('/'); 11 return { 12 uri: blurhash, 13 width: parseInt(width, 10) || 16, 14 height: parseInt(height, 10) || 16, 15 }; 16} 17/** 18 * Converts a string in thumbhash format (`thumbhash:/<hash>` or `<hash>`) 19 * into an `ImageSource`. 20 * Note: Unlike the `resolveBlurhashString` the `thumbhash:/` scheme has to be present, 21 * as the scheme has to be explicitly stated to be interpreted a `thumbhash` source. 22 * 23 * @return An ImageSource representing the provided thumbhash. 24 * */ 25export function resolveThumbhashString(str) { 26 const hash = str.replace(/^thumbhash:\//, ''); 27 return { 28 uri: 'thumbhash:/' + hash, 29 }; 30} 31//# sourceMappingURL=resolveHashString.web.js.map