UNPKG

@react-native-vector-icons/common

Version:

Customizable Icons for React Native with support for image source and full styling.

35 lines (34 loc) 678 B
"use strict"; const TYPE_VALUE = 'value'; const TYPE_ERROR = 'error'; export default function createIconSourceCache() { const cache = new Map(); const setValue = (key, value) => cache.set(key, { type: TYPE_VALUE, data: value }); const setError = (key, error) => cache.set(key, { type: TYPE_ERROR, data: error }); const get = key => { const value = cache.get(key); if (!value) { return undefined; } const { type, data } = value; if (type === TYPE_ERROR) { throw data; } return data; }; return { setValue, setError, get }; } //# sourceMappingURL=create-icon-source-cache.js.map