class-o-mat
Version:
ALPHA VERSION ONLY: class-o-mats will help to create getter-setter functionality with validations that can be attached to a container class for easier coding. Some basic validations are included. class-o-mats also has the ability to store params as bloc
35 lines (23 loc) • 541 B
JavaScript
import Bunyan from 'bunyan';
const log = Bunyan.createLogger({name: "ApiField"});
import { NONE, API_METHOD } from '../constants/types';
class ApiMethod {
TYPE = API_METHOD;
constructor(parent) {
this._params = {
parent,
apiKey: NONE,
value: NONE,
}
}
$() {
const { method, _paramObjectKey } = this;
const { apiKey, _default, parent } = this._params;
parent[apiKey] = method;
}
as(apiKey) {
this._params.apiKey = apiKey;
return this;
}
}
export default ApiMethod;