Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@jill64/svelte-storage
Advanced tools
🗃️ Type-Safe Web Storage API Wrapper for Svelte
npm i @jill64/svelte-storage
Passing the localStorage
key to the storage
function will retrieve the svelte-store of that value.
<script>
import { storage } from '@jill64/svelte-storage'
/** @type {Writable<string>} */
const str = storage('localStorage-key', {
// Use sessionStorage instead of localStorage
// sessionStorage: boolean (default: false)
})
// Get value
$: consol.log($str)
// Set value
$str = 'value'
// or
str.set('value')
</script>
By passing a conversion function as the second argument, you can get the value converted to any type.
<script>
import { storage } from '@jill64/svelte-storage'
import { number } from '@jill64/svelte-storage/serde'
/** @type {Writable<number>} */
const store = storage(
'localStorage-key',
{
stringify: (value) => value.toString(),
parse: (str) => parseInt(str)
}
// {
// Storage Option
// }
)
</script>
You can also use the prepared converters in @jill64/svelte-storage/serde
.
<script>
import { storage } from '@jill64/svelte-storage'
import { number } from '@jill64/svelte-storage/serde'
/** @type {Writable<number>} */
const num = storage(
'localStorage-key',
number
// {
// Storage Option
// }
)
</script>
FAQs
🗃️ Type-Safe Web Storage API Wrapper for Svelte
We found that @jill64/svelte-storage demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.