UNPKG

@aws-amplify/core

Version:
38 lines (36 loc) 879 B
'use strict'; // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 Object.defineProperty(exports, "__esModule", { value: true }); exports.InMemoryStorage = void 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(); } } exports.InMemoryStorage = InMemoryStorage; //# sourceMappingURL=InMemoryStorage.js.map