@apitizer/query
The query package of apitizer aims for a chainable and flat api to generate query strings a semantic way.
It's designed to follow functional principles.
The query package has no dependencies and can be used as standalone utility.
Installation
yarn add @apitizer/query
or
npm install @apitizer/query
API Documentation
You can see the technical api documentation here
Examples
import { query } from '@apitizer/query';
const empty = query();
const withInitialParams = query({ token: '123abc' });
const withStatus = query().param('status', 'active');
const withStatusAndName = withStatus.param('name', 'foo');
const withOrderAndDirection = query().params({
by: 'status',
direction: 'asc'
});
const withStatusWithoutName = withStatusAndName.param('name', undefined);
const cleared = withStatusAndName.clear();
console.log(cleared.empty());
console.log(withStatusAndName.empty());
console.log(empty.get());
console.log(withInitialParams.get());
console.log(withStatus.get());
console.log(withStatusAndName.get());
console.log(withOrderAndDirection.get());
console.log(withStatusWithoutName.get());
console.log(cleared.get());