New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nanostores

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nanostores - npm Package Compare versions

Comparing version 0.9.4 to 0.9.5

20

deep-map/path.d.ts

@@ -43,2 +43,12 @@ type ConcatPath<T extends string, P extends string> = T extends ''

type ElementType<T> = T extends (infer U)[] ? U : never
type Unwrap<T, P> = P extends `[${infer I}]${infer R}`
? [ElementType<T>, IsNumber<I>] extends [infer Item, true]
? R extends ''
? Item
: Unwrap<Item, R>
: never
: never
type NestedObjKey<T, P> = P extends `${infer A}.${infer B}`

@@ -56,5 +66,9 @@ ? A extends keyof T

]
? R extends `.${infer NewR}`
? FromPath<Item, NewR>
: Item
? R extends ''
? Item
: R extends `.${infer NewR}`
? FromPath<Item, NewR>
: R extends `${infer Indices}.${infer MoreR}`
? FromPath<Unwrap<Item, Indices>, MoreR>
: Unwrap<Item, R>
: never

@@ -61,0 +75,0 @@ : never

16

deep-map/path.js

@@ -41,11 +41,13 @@ export function getPath(obj, path) {

function getAllKeysFromPath(path) {
return path.split('.').flatMap(key => {
if (ARRAY_INDEX.test(key)) {
let res = key.match(ARRAY_INDEX)
return res.slice(1)
}
return [key]
})
return path.split('.').flatMap(key => getKeyAndIndicesFromKey(key))
}
function getKeyAndIndicesFromKey(key) {
if (ARRAY_INDEX.test(key)) {
let [, keyPart, index] = key.match(ARRAY_INDEX)
return [...getKeyAndIndicesFromKey(keyPart), index]
}
return [key]
}
function ensureKey(obj, key, nextKey) {

@@ -52,0 +54,0 @@ if (key in obj) {

{
"name": "nanostores",
"version": "0.9.4",
"description": "A tiny (297 bytes) state manager for React/Preact/Vue/Svelte with many atomic tree-shakable stores",
"version": "0.9.5",
"description": "A tiny (298 bytes) state manager for React/Preact/Vue/Svelte with many atomic tree-shakable stores",
"keywords": [

@@ -6,0 +6,0 @@ "store",

@@ -10,3 +10,3 @@ # Nano Stores

* **Small.** Between 297 and 1013 bytes (minified and gzipped).
* **Small.** Between 298 and 1013 bytes (minified and gzipped).
Zero dependencies. It uses [Size Limit] to control size.

@@ -13,0 +13,0 @@ * **Fast.** With small atomic and derived stores, you do not need to call

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc