Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
The idea behind Hacksaw is contextual store which means you have one store which you can generate sub stores using contexts and also all model instances will be shared among contexts.
Hacksaw is a data store library for javascript. You can store all the states along the app life time with view stores.
The idea behind Hacksaw is contextual store which means you have one store which you can generate sub stores using contexts and also all model instances will be shared among contexts.
npm install hacksaw --save
import { createStore } from 'hacksaw';
const store = createStore({
tables: {
products: {},
users: {
relations: {
products: {
type: Array,
table: 'products'
}
}
}
}
});
// products table is empty
store.products.all; // []
// create view stores
const bestViewStore = store.view('best');
const trendingViewStore = store.view('trending');
bestViewStore.products.all; // []
trendingViewStore.products.all; // []
// add a product to view store 'best'
bestViewStore.products.put({ id: 1, name: 'A book' });
// add a product to view store 'trending'
trendingViewStore.products.put({ id: 2, name: 'Trending book' });
// global products table has 2 items
store.products.all
// [{ id: 1, name: 'A book' }, { id: 2, name: 'Trending book' }]
// view store 'best' has 1 item
bestViewStore.all;
// [{ id: 1, name: 'A book' }]
// create another view store and populate data
const anotherViewStore = store.view('another-context');
anotherViewStore.products.populate(i => i.id === 1);
anotherViewStore.products.first
// { id: 1, name: 'A book' }
// clean trending view store
trendingViewStore.clean();
trendingViewStore.products.all; // []
store.products.all // [{ id: 1, name: 'A book' }, { id: 2, name: 'Trending book' }]
// add data has relations
store.users.put({ id: 1, name: 'Plato', products: [{ id: 1, name: 'Apology' }] });
store.users.first;
// { id: 1, name: 'Plato', products: [{ id: 1, name: 'Apology' }] }
store.products.all;
// [{ id: 1, name: 'Apology' }, { id: 2, name: 'Trending book' }]
FAQs
The idea behind Hacksaw is contextual store which means you have one store which you can generate sub stores using contexts and also all model instances will be shared among contexts.
We found that hacksaw demonstrated a not healthy version release cadence and project activity because the last version was released 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.