@daiso-tech/core
Version:
The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.
27 lines • 625 B
JavaScript
/**
* @module Codec
*/
import { EncodingError, DecodingError, } from "../../../codec/contracts/_module.js";
/**
* IMPORT_PATH: `"@daiso-tech/core/codec/base-64-codec"`
* @group Implementations
*/
export class Base64Codec {
encode(decodedValue) {
try {
return btoa(decodedValue);
}
catch (error) {
throw EncodingError.create(error);
}
}
decode(encodedValue) {
try {
return atob(encodedValue);
}
catch (error) {
throw DecodingError.create(error);
}
}
}
//# sourceMappingURL=base-64-codec.js.map