Object type data query builder
$ npm install --save object-querybuilder
const query = require('object-querybuilder');
const users = [
{ name: 'Lucy', age: 23, gender: 'woman' },
{ name: 'Emma', age: 31, gender: 'woman' },
{ name: 'Daniel', age: 18, gender: 'man' },
{ name: 'Olivia', age: 42, gender: 'woman' },
{ name: 'Alex', age: 33, gender: 'man' }
];
const countrys = [
{ name: 'Lucy', country: 'New York' },
{ name: 'Daniel', country: 'France' },
{ name: 'Emma', country: 'Germany' }
];
const result = query
.select(['*'])
.from(users)
.join(countrys, 'name')
.where('age', '>', 30)
.run();
/**
[
{ name: 'Emma', age: 31, gender: 'woman', country: 'Germany' }
]
**/
import query from 'object-querybuilder';
const users = [
{ name: 'Lucy', age: 23, gender: 'woman' },
{ name: 'Emma', age: 31, gender: 'woman' },
{ name: 'Daniel', age: 18, gender: 'man' },
{ name: 'Olivia', age: 42, gender: 'woman' },
{ name: 'Alex', age: 33, gender: 'man' }
];
const countrys = [
{ name: 'Lucy', country: 'New York' },
{ name: 'Daniel', country: 'France' },
{ name: 'Emma', country: 'Germany' }
];
const result = query
.select(['*'])
.from(users)
.join(countrys, 'name')
.where('age', '>', 30)
.run();
/**
[
{ name: 'Emma', age: 31, gender: 'woman', country: 'Germany' }
]
**/
When | Commit Message |
---|---|
Add function | feat: ⚡️ Add function |
Fix bug | fix: 🐞 Fix bug |
Refactoring | refactor: 🛠 Refactoring |
Add package | package: 📦 Add package |
Fix readme | docs: 📚 Fix readme |
Improvements style | style: 👁 Improvements style |
New Releases | releases: 🎉 Releases |