/** * check if the input data is matched by this targeting instance * * @param {Object} inputTargeting is normally a simple js object * @return {Boolean} */ match(inputTargeting) { debug('match() %o', inputTargeting) if (isNullOrUndefined(inputTargeting)) { throw new TypeError('inputTargeting cannot be null or undefined') } return this[_isMatch](inputTargeting) }
/** * @param {Variant} options.object the variation data * @param {Number} options.weight * */ constructor({ object, weight = 1 }) { if (isNullOrUndefined(object)) { let error = new TypeError('cannot create variation without an object') error.code = _missingObjectErrorCode throw error } this[_object] = object // use the setter instead of directly setting the field this.weight = weight }
if (util.isNullOrUndefined( url )) { logger.warn( `hash ${hash} does not exist in db, redirect to index` );