UNPKG

@aws-amplify/core

Version:
35 lines (33 loc) 754 B
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 /** * @internal */ class InMemoryStorage { constructor() { this.storage = new Map(); } get length() { return this.storage.size; } key(index) { if (index > this.length - 1) { return null; } return Array.from(this.storage.keys())[index]; } setItem(key, value) { this.storage.set(key, value); } getItem(key) { return this.storage.get(key) ?? null; } removeItem(key) { this.storage.delete(key); } clear() { this.storage.clear(); } } export { InMemoryStorage }; //# sourceMappingURL=InMemoryStorage.mjs.map