[firestore][js] additional Blob class input arg validations
This commit is contained in:
parent
86a8385f2a
commit
d493e00a67
|
@ -14,6 +14,12 @@ export default class Blob {
|
|||
* @param base64 string
|
||||
*/
|
||||
static fromBase64String(base64: string): Blob {
|
||||
if (typeof base64 !== 'string' || base64.length < 1) {
|
||||
throw new Error(
|
||||
'firestore.Blob.fromBase64String expects a string of at least 1 character in length'
|
||||
);
|
||||
}
|
||||
|
||||
return new Blob(Base64.atob(base64));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue