mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-11 00:36:26 +00:00
16 lines
431 B
JavaScript
16 lines
431 B
JavaScript
const _ = require('lodash')
|
|
|
|
export function findStorage(storageKey) {
|
|
const cachedStorageList = JSON.parse(localStorage.getItem('storages'))
|
|
if (!_.isArray(cachedStorageList))
|
|
throw new Error("Target storage doesn't exist.")
|
|
const storage = _.find(cachedStorageList, { key: storageKey })
|
|
if (storage === undefined) throw new Error("Target storage doesn't exist.")
|
|
|
|
return storage
|
|
}
|
|
|
|
export default {
|
|
findStorage
|
|
}
|