/** * Creates an instance of MqttTransporter. * * @param {any} opts * * @memberof MqttTransporter */ constructor(opts) { super(opts); this.qos = 0; this.topicSeparator = "."; if (isObject(this.opts)) { if (this.opts.qos !== undefined) { this.qos = this.opts.qos; delete this.opts.qos; } if (this.opts.topicSeparator !== undefined) { this.topicSeparator = this.opts.topicSeparator; delete this.opts.topicSeparator; } } this.client = null; }
map(this.state.errors, (error, key) => { const displayError = isObject(error) && error.id ? <FormattedMessage {...error} /> : error; return ( <div key={key} className="form-control-feedback invalid-feedback" style={{marginBottom: '1.8rem', fontSize: '1.3rem' }}>{displayError}</div> ); })
function getDefault(prompt = {}) { if (prompt.choices && prompt.choices.length) { const defaultChoice = prompt.choices[prompt.default]; return isObject(defaultChoice) ? defaultChoice.value : defaultChoice; } return prompt.default; }
const fire = argv => input => { if (isFunction(input)) { return handleFunction(argv)(input) } if (isObject(input)) { const cleansed = fclone(input) return handleObject(argv)(cleansed) } throw new InvariantViolationError() }
pullAll(Object.keys(this.config.currentEnvironment), middlewareCategories).reduce((acc, index) => { const current = this.config.currentEnvironment[index]; if (isObject(current)) { acc = merge(acc, { [index]: current }); } else { acc[index] = current; } return acc; }, {})
extractName(command) { if (isObject(command) === false || isString(command.constructor.name) === false ) { throw new InvalidCommandException('Invalid Command Name.'); } return command.constructor.name; }
Object.keys(this.middleware).reduce((acc, current) => { // Try to find the settings in the current environment, then in the main configurations. const currentSettings = merge(get(cloneDeep(this.middleware[current]), ['defaults', current], {}), flattenMiddlewaresConfig[current] || this.config.currentEnvironment[current] || this.config[current]); acc[current] = !isObject(currentSettings) ? {} : currentSettings; if (!acc[current].hasOwnProperty('enabled')) { this.log.warn(`(middleware:${current}) wasn't loaded due to missing key \`enabled\` in the configuration`); } // Ensure that enabled key exist by forcing to false. defaults(acc[current], { enabled : false }); return acc; }, {})
export function serializePropertyValue(value) { if (isArray(value)) return value.map(sub => serializePropertyValue(sub)); if (isObject(value) && Reflect.has(value, `serialize`)) return value.serialize(); return value; }
/** * Check the instance for object representation of Geo Point. * If representation is null, new object is initialised. * If it is not null, warning is logged and point is overwritten. * @private */ _checkObjRepr() { if (isNil(this._point)) this._point = {}; else if (!isObject(this._point)) { this._warnMixedRepr(); this._point = {}; } }
/** * Check that the object property `this._suggestOpts.fuzzy` is an object. * Set empty object if required. * * @private */ _checkFuzzy() { if (!isObject(this._suggestOpts.fuzzy)) { this._suggestOpts.fuzzy = {}; } }
Object.keys(entry.fields).map((key) => { const field = entry.fields[key] if (isObject(field)) { return [entry.fields[key], publishedEntry.fields[key]] } }).filter(Boolean)
constructor(handlers = {}) { super(); this.handlers = {}; if (isObject(handlers)) { this.handlers = reduce(handlers, (carry, Handler, key) => { carry[key] = isFunction(Handler) ? new Handler() : Handler; // eslint-disable-line return carry; }, {}); } }
write(data, enc, cb) { // Bunyan sometimes passes things as objects. Because of this, we need to make sure // the data is converted to JSON if (isObject(data) && !(data instanceof Buffer)) { data = JSON.stringify(data); } super.write(data, enc, cb); }
map(this.state.errors, (error, key) => { const displayError = isObject(error) && error.id ? <FormattedMessage id={error} /> : error; return ( <div key={key} className="form-control-feedback invalid-feedback" style={{ fontSize: '1.3rem' }}>{displayError}</div> ); })
map(this.state.errors, (error, key) => { const displayError = isObject(error) && error.id ? <FormattedMessage {...error} /> : error; return ( <div key={key} className="form-control-feedback invalid-feedback" style={{marginBottom: '1.8rem', fontSize: '1.3rem' }}>{displayError}</div> ); })