UNPKG

react-native-mmkv

Version:

The fastest key/value storage for React Native. ~30x faster than AsyncStorage! Works on Android, iOS and Web.

17 lines (16 loc) 433 B
/* global TextEncoder */ export function createTextEncoder(): TextEncoder { if (global.TextEncoder != null) { return new global.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', }; } }