New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@inglorious/store

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inglorious/store - npm Package Compare versions

Comparing version
9.5.3
to
9.6.0
+1
-1
package.json
{
"name": "@inglorious/store",
"version": "9.5.3",
"version": "9.6.0",
"description": "A state manager for real-time, collaborative apps, inspired by game development patterns and compatible with Redux.",

@@ -5,0 +5,0 @@ "author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",

@@ -22,6 +22,18 @@ export function createApi(store, extras) {

/**
* Retrieves the full entities state.
* @returns {Object}
* Retrieves entities.
* If `typeName` is omitted, returns the full entities state object.
* If `typeName` is provided, returns an array of entities of that type.
* @param {string} [typeName]
* @returns {Object|Object[]}
*/
getEntities: store.getState,
getEntities: (typeName) => {
const entities = store.getState()
if (typeName == null) {
return entities
}
return Object.values(entities).filter(
(entity) => entity.type === typeName,
)
},
/**

@@ -28,0 +40,0 @@ * Retrieves a single entity by ID.

@@ -15,2 +15,3 @@ import { create } from "mutative"

* - `getEntities()`: Returns all entities (frozen)
* - `getEntities(typeName)`: Returns entities matching that type (frozen array)
* - `getEntity(id)`: Returns a specific entity by ID (frozen)

@@ -41,4 +42,10 @@ * - `select(selector)`: Runs a selector against the entities

return {
getEntities() {
return frozenEntities
getEntities(typeName) {
if (typeName == null) {
return frozenEntities
}
return Object.values(frozenEntities).filter(
(entity) => entity.type === typeName,
)
},

@@ -45,0 +52,0 @@ getEntity(id) {

@@ -20,3 +20,6 @@ import type {

setType: (typeName: string, type: EntityType<TEntity>) => void
getEntities: () => TState
getEntities: {
(): TState
(typeName: string): TEntity[]
}
getEntity: (id: string) => TEntity | undefined

@@ -23,0 +26,0 @@ select: <TResult>(selector: (state: TState) => TResult) => TResult

@@ -10,3 +10,6 @@ import type { BaseEntity, EntitiesState } from "./store"

> {
getEntities: () => TState
getEntities: {
(): TState
(typeName: string): TEntity[]
}
getEntity: (id: string) => TEntity | undefined

@@ -13,0 +16,0 @@ select: <TResult>(selector: (state: TState) => TResult) => TResult