@toshihiko/base-adapter
v1.2.0
Published
The base adapter for Toshihiko.js
Downloads
12
Readme
Toshihiko Base Adapter
Toshihiko Base Adapter is a TypeScript library for extending object properties and providing basic database adapter functionalities.
Installation
Install the package using npm:
npm install --save @toshihiko/base-adapter
Usage
Extending Object Properties
The extend
function is used to extend the properties of an object.
import { extend } from '@toshihiko/base-adapter';
const defaultOptions = { a: 1, b: { c: 2 } };
const options = { b: { d: 3 }, e: 4 };
const result = extend(defaultOptions, options);
console.log(result);
// Output: { a: 1, b: { c: 2, d: 3 }, e: 4 }
Database Adapter
The Adapter
class provides basic database adapter functionalities.
import { Adapter, AdapterOptions } from '@toshihiko/base-adapter';
const options = { key: 'value' };
const adapter = new Adapter<{ key: string }>(options);
adapter.find({}, {}).catch(err => console.error(err.message));
// Output: this adapter's find function is not implemented yet.
Contributing
Feel free to submit issues and pull requests to improve this project.
License
This project is licensed under the MIT License. See the LICENSE file for details.