function PaneWrapper (Wrappee, opts) { assert(validate.isInteger(opts.x), `${opts.x} is not an integer`) assert(validate.isInteger(opts.y), `${opts.y} is not an integer`) assert(validate.isInteger(opts.width), `${opts.width} is not an integer`) assert(validate.isInteger(opts.height), `${opts.height} is not an integer`) const offset = (opts.grid && opts.grid.offset) || { x: 0, y: 0 } const wrapped = getWrappedObject(Wrappee, opts, offset) if (typeof wrapped.setBounds === 'function') { const currentBounds = wrapped.getBounds() wrapped.setBounds(Object.assign({}, currentBounds, { x: opts.x + offset.x, y: opts.y + offset.y, width: opts.width, height: opts.height })) } if (!validate.isDefined(opts.id) && !validate.isDefined(wrapped.id)) { if (typeof wrapped.close === 'function') wrapped.close() throw new Error('id is not defined') } let state = { wrapped, grid: opts.grid, id: opts.id || wrapped.id, width: opts.width, height: opts.height, x: opts.x, y: opts.y } const emitter = new EventEmitter() return Object.assign( state, { on: emitter.on, once: emitter.once, emit: emitter.emit, removeListener: emitter.removeListener, removeAllListeners: emitter.removeAllListeners // TODO: rest of relevant emitter methods }, sizeChanger(state), locationChanger(state), directionalResizer(state), destructor(state) ) }
Validators.prototype.isInt64 = function(obj) { if(typeof obj !== 'undefined' && obj !== null) { var val = validate.isInteger(obj); if (!val) { return util.constructValidationMessage(val, "Type is not a Int64"); } } return true; };
function Grid (width, height, offset) { assert(validate.isInteger(width), `${width} is not an integer`) assert(validate.isInteger(height), `${height} is not an integer`) offset = offset || { x: 0, y: 0 } let state = { offset, width, height, panes: [] } return Object.assign( state, paneAdder(state), paneGetter(state), paneRemover(state), paneChanger(state) ) }
Validators.prototype.isInt32 = function(obj) { if(typeof obj !== 'undefined' && obj !== null) { var val = validate.isInteger(obj); if (!val) { return util.constructValidationMessage(val, "Type is not a date"); } if(obj > 2147483647 || obj < -2147483647) { return util.constructValidationMessage(false, "Int Exceeds 32-bits"); } } return true; };