0.0.1 • Published 5 years ago
@iljucha/collection v0.0.1
Collection
Usage
import Collection from "@iljucha/collection";
let items = [
{ _id: 1, text: "hello" },
{ _id: 2, text: "bye" }
];
let col = new Collection(items);
// items[0]
col.findOne({ _id: 1 });
// items[0]
col.findMany({
$or: [
{ text: { $regexp: /hello/i } },
{ text: { $includes: "hello" } }
]
});
// items[1]
col.findMany({
$and: [
{ _id: { $eq: 2 } },
{ text: "bye" }
]
});
// items[0] && items[1]
col.findMany({
_id: { $type: "number" },
$or: [
{ text: { $includes: "hello" } },
{ text: { $regexp: /bye/i } },
]
});
0.0.1
5 years ago