mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
Sorry about the thrash in advance! This removes the top level `forget` directory which adds unnecessary nesting to our repo Hopefully everything still works
30 lines
696 B
TypeScript
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)));
|
|
},
|
|
};
|