BlobArray
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v52View latest version
Create an array as a Database, instantly!
Just create a new val for your array:
import { BlobArray } from "https://esm.town/v/joey/BlobArray";
type User = { email: string };
// specify the type inside the TS generic <> to define the type of your array
export let myUserArray = BlobArray<User>("my-user-array");
Now import it and start using it in your vals!
import { myUserArray } from "https://esm.town/v/joey/myUserArray";
// overwrite the entire array
await myUserArray.set([{ email: "user1@gmail.com" }, { email: "user2@yahoo.com" }]);
// get all the entries in your array
const allUsers = await myUserArray.get();
// call any array method you want, just use "await"
await myUserArray.push({ email: "johndoe@gmail.com" });
const gmailUsers = await myUserArray.filter(u => u.email.includes("@gmail.com"));
Migrated from folder: BlobArray/BlobArray