react/compiler/apps/playground/lib/utils.ts
lauren a0dc166991 [rfc] Remove top level forget directory
Sorry about the thrash in advance! This removes the top level `forget` directory 
which adds unnecessary nesting to our repo 

Hopefully everything still works
2023-08-22 15:04:54 -04:00

30 lines
696 B
TypeScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
/**
* Unicode-Base64 Codec.
*
* @see https://base64.guru/developers/javascript/examples/unicode-strings
* @see https://github.com/vuejs/core/pull/3662/
*/
export const codec = {
utoa(data: string): string {
return btoa(unescape(encodeURIComponent(data)));
},
/**
* @returns undefined if @base64 is not a valid Base64 string.
*/
atou(base64: string): string {
return decodeURIComponent(escape(atob(base64)));
},
};