react-native-mmkv
Version:
⚡️ The fastest key/value storage for React Native.
17 lines (16 loc) • 437 B
text/typescript
export function createTextEncoder(): TextEncoder {
const g = global ?? globalThis ?? window
if (g.TextEncoder != null) {
return new g.TextEncoder()
} else {
return {
encode: () => {
throw new Error('TextEncoder is not supported in this environment!')
},
encodeInto: () => {
throw new Error('TextEncoder is not supported in this environment!')
},
encoding: 'utf-8',
}
}
}