Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bullet

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bullet - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

2

package.json
{
"name": "bullet",
"version": "0.0.3",
"version": "0.0.4",
"exports": "./bullet.js",

@@ -5,0 +5,0 @@ "types": "./bullet.d.ts",

@@ -23,3 +23,3 @@ # Pierce the Boilerplate

```js
import {Entity} from "bullet"
import { Entity } from "bullet";

@@ -43,3 +43,3 @@ export class Book extends Entity {

By default, the name of the slice is the snake_cased, plural, lowercased class name, but it can be configured using the static `sliceName` attribute.
By default, the name of the slice is the camelCased, plural class name, but it can be configured using the static `sliceName` attribute.

@@ -65,7 +65,7 @@ ```js

```js
import {Entity} from "bullet"
import { Entity } from "bullet";
const store = configureStore( /* ... */ )
const store = configureStore(/* ... */);
Entity.store = store
Entity.store = store;
```

@@ -82,3 +82,3 @@

```js
const book = Book.create({title: "The Secret Art of React"})
const book = Book.create({ title: "The Secret Art of React" });
```

@@ -91,5 +91,5 @@

```js
book.title // "The Secret Art of React"
book.pageCount // 0
book.attributes // {id: "1", title: "The Secret Art of React", pageCount: 0, ...}
book.title; // "The Secret Art of React"
book.pageCount; // 0
book.attributes; // {id: "1", title: "The Secret Art of React", pageCount: 0, ...}
```

@@ -102,5 +102,5 @@

```js
const book = Book.create({title: "Pierce the Boilerplate"})
book.pageCount = 4
book.save() // Updates the store with the new page count.
const book = Book.create({ title: "Pierce the Boilerplate" });
book.pageCount = 4;
book.save(); // Updates the store with the new page count.
```

@@ -111,3 +111,3 @@

```js
book.update({author: "JK"}) // Also updates the store.
book.update({ author: "JK" }); // Also updates the store.
```

@@ -120,5 +120,5 @@

```js
const book = new Book({title: "React for Dummies"}) // Not saved
const book = new Book({ title: "React for Dummies" }); // Not saved
book.save() // But now it's saved and given an id.
book.save(); // But now it's saved and given an id.
```

@@ -131,4 +131,4 @@

```js
const book = Book.create({title: "Incriminating Evidence"})
book.destroy() // Removed from the store
const book = Book.create({ title: "Incriminating Evidence" });
book.destroy(); // Removed from the store
```

@@ -141,3 +141,3 @@

```js
const book = Book.find("1")
const book = Book.find("1");
```

@@ -148,3 +148,3 @@

```js
const books = Book.all
const books = Book.all;
```

@@ -155,3 +155,3 @@

```js
const books = Book.where({pageCount: 99})
const books = Book.where({ pageCount: 99 });
```

@@ -167,5 +167,5 @@

function LibraryInventory() {
const everything = Book.useAll
const filtered = Book.useWhere({topic: "Teen Vampire"})
const single = Book.use("1")
const everything = Book.useAll;
const filtered = Book.useWhere({ topic: "Teen Vampire" });
const single = Book.use("1");
}

@@ -177,7 +177,7 @@ ```

```js
import {useSelector} from "react-redux"
import {Entity} from "bullet"
import { useSelector } from "react-redux";
import { Entity } from "bullet";
// To use the selector hooks...
Entity.useSelector = useSelector
Entity.useSelector = useSelector;
```

@@ -192,14 +192,14 @@

static attributes = {
authorId: {type: String, default: null}
}
authorId: { type: String, default: null },
};
burn() {
// Select some state and dispatch an action.
const canBurn = this.select(getCanBurn)
if (canBurn) this.dispatch(burnBook(this.id))
const canBurn = this.select(getCanBurn);
if (canBurn) this.dispatch(burnBook(this.id));
}
get author() {
// Utilize your other entities.
return Author.find(this.authorId)
return Author.find(this.authorId);
}

@@ -209,3 +209,2 @@ }

## The KeyVal Reducer

@@ -212,0 +211,0 @@

@@ -118,8 +118,12 @@ import { createSlice, nanoid } from "@reduxjs/toolkit";

} else {
this.Slice.dispatch(
this.Slice.actions.update({ id: this.id, changes: this.serialize() })
);
this.update({ id: this.id, changes: this.serialize() });
}
}
update(attrs = {}) {
this.Slice.dispatch(
this.Slice.actions.update({ id: this.id, changes: attrs })
);
}
destroy() {

@@ -126,0 +130,0 @@ this.dispatch(this.Slice.actions.destroy(this.id));

@@ -109,1 +109,7 @@ import "./test-helper.js";

});
test("update", () => {
const book = Book.create({ title: "Hello" });
book.update({ title: "Goodbye" });
assert.equal("Goodbye", Book.find(book.id).title);
});
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