Socket
Socket
Sign inDemoInstall

@ngneat/elf

Package Overview
Dependencies
Maintainers
3
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ngneat/elf - npm Package Compare versions

Comparing version 1.0.0-beta.2 to 1.0.0-beta.3

6

package.json
{
"name": "@ngneat/elf",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"description": "A reactive state management for JS applications",

@@ -32,3 +32,3 @@ "publishConfig": {

"peerDependencies": {
"rxjs": "*"
"typescript": ">= 4.1.2"
},

@@ -38,2 +38,2 @@ "main": "./store.umd.js",

"typings": "./index.d.ts"
}
}

@@ -5,72 +5,73 @@ <p align="center">

> A Reactive Store with Magical Powers (wip)
# Elf
[comment]: <> (Elf is a reactive immutable state management solution built on top of RxJS. It uses custom RxJS operators to query the state and pure functions to update it.)
> A Reactive Store with Magical Powers
[comment]: <> (Elf encourages simplicity. It eases the hassle of creating boilerplate code and comes with robust tools, suitable for both experienced and inexperienced developers.)
Elf is a reactive immutable state management solution built on top of RxJS. It uses custom RxJS operators to query the state and pure functions to update it.
[comment]: <> ([![@ngneat/elf]&#40;https://github.com/ngneat/elf/actions/workflows/ci.yml/badge.svg&#41;]&#40;https://github.com/ngneat/elf/actions/workflows/ci.yml&#41;)
Elf encourages simplicity. It eases the hassle of creating boilerplate code and comes with robust tools, suitable for both experienced and inexperienced developers.
[comment]: <> ([![commitizen]&#40;https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square&#41;]&#40;&#41;)
✅ &nbsp;Modular by design
✅ &nbsp;Tree Shakeable & Fully Typed
✅ &nbsp;CLI
✅ &nbsp;First Class Entities Support
✅ &nbsp;Requests Status & Cache
✅ &nbsp;Persist State
✅ &nbsp;State History
✅ &nbsp;Pagination
✅ &nbsp;Devtools
[comment]: <> ([![PRs]&#40;https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square&#41;]&#40;&#41;)
[comment]: <> ([![coc-badge]&#40;https://img.shields.io/badge/codeof-conduct-ff69b4.svg?style=flat-square&#41;]&#40;&#41;)
<hr />
[comment]: <> ([![semantic-release]&#40;https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e5079.svg?style=flat-square&#41;]&#40;https://github.com/semantic-release/semantic-release&#41;)
<p align="center">
[comment]: <> ([![styled with prettier]&#40;https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?style=flat-square&#41;]&#40;https://github.com/prettier/prettier&#41;)
[![@ngneat/elf](https://github.com/ngneat/elf/actions/workflows/ci.yml/badge.svg)](https://github.com/ngneat/elf/actions/workflows/ci.yml)
[![commitizen](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)]()
[![PRs](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)]()
[![coc-badge](https://img.shields.io/badge/codeof-conduct-ff69b4.svg?style=flat-square)]()
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e5079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
</p>
[comment]: <> (## Features)
## 🤓 Learn about it on the [docs site](https://ngneat.github.io/elf/)
## 👩‍🎓 Check out the React Todos [example](https://stackblitz.com/edit/react-ts-jidhej?file=todos/todos.tsx)
## 😋 Check out the Angular Todos [example](https://stackblitz.com/edit/angular-ivy-sky1gb?file=src/app/todos/state/todos.repository.ts)
[comment]: <> (☑️ Modular by design <br>)
<br >
[comment]: <> (☑️ Tree Shakeable & Fully Typed <br>)
```ts
import { Store, createState, withProps, select } from '@ngneat/elf';
import { withEntities, selectAll, setEntities } from '@ngneat/elf-entities';
[comment]: <> (☑️ CLI <br>)
interface TodosProps {
filter: 'ALL' | 'ACTIVE' | 'COMPLETED';
}
[comment]: <> (☑️ First Class Entities Support<br>)
interface Todo {
id: string;
title: string;
status: string;
}
[comment]: <> (☑️ Requests Status & Cache <br>)
const { state, config } = createState(
withProps<TodosProps>({ filter: 'ALL' }),
withEntities<Todo>()
);
[comment]: <> (☑️ Persist State<br>)
const store = new Store({ name: 'todos', state, config });
[comment]: <> (☑️ State History<br>)
export const filter$ = store.pipe(select(({ filter }) => filter));
export const todos$ = store.pipe(selectAll());
[comment]: <> (☑️ Pagination<br>)
export function setTodos(todos: Todo[]) {
store.reduce(setEntities(todos));
}
[comment]: <> (☑️ Devtools)
[comment]: <> (```ts)
[comment]: <> (import { Store, createState, withProps, select } from '@ngneat/elf';)
[comment]: <> (interface AuthProps {)
[comment]: <> ( user: { id: string } | null;)
[comment]: <> (})
[comment]: <> (const { state, config } = createState&#40;withProps<AuthProps>&#40;{ user: null }&#41;&#41;;)
[comment]: <> (const authStore = new Store&#40;{ state, name, config }&#41;;)
[comment]: <> (class AuthRepository {)
[comment]: <> ( user$ = authStore.pipe&#40;select&#40;&#40;state&#41; => state.user&#41;&#41;;)
[comment]: <> ( updateUser&#40;user: AuthProps['user']&#41; {)
[comment]: <> ( authStore.reduce&#40;&#40;state&#41; => &#40;{)
[comment]: <> ( ...state,)
[comment]: <> ( user: { id: 'Elf' },)
[comment]: <> ( }&#41;&#41;;)
[comment]: <> ( })
[comment]: <> (})
[comment]: <> (```)
export function updateFilter(filter: TodosProps['filter']) {
store.reduce(state => ({
...state,
filter
}));
}
```
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