UNPKG

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

59 lines (43 loc) 1.88 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _bunyan = require('bunyan'); var _bunyan2 = _interopRequireDefault(_bunyan); var _types = require('../constants/types'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var log = _bunyan2.default.createLogger({ name: "ApiField" }); var ApiMethod = function () { function ApiMethod(parent) { _classCallCheck(this, ApiMethod); this.TYPE = _types.API_METHOD; this._params = { parent: parent, apiKey: _types.NONE, value: _types.NONE }; } _createClass(ApiMethod, [{ key: '$', value: function $() { var method = this.method, _paramObjectKey = this._paramObjectKey; var _params = this._params, apiKey = _params.apiKey, _default = _params._default, parent = _params.parent; parent[apiKey] = method; } }, { key: 'as', value: function as(apiKey) { this._params.apiKey = apiKey; return this; } }]); return ApiMethod; }(); exports.default = ApiMethod; //# sourceMappingURL=api-method.js.map