update beacon and location methods to use overload

Signed-off-by: nuts-n-bits <nuts-n-bits@outlook.com>
This commit is contained in:
nuts-n-bits
2019-12-10 12:56:20 -05:00
committed by Alexander Cerutti
parent 33e0f43f66
commit 9565bf0944

View File

@@ -281,17 +281,19 @@ export class Pass {
/** /**
* Sets current pass' relevancy through beacons * Sets current pass' relevancy through beacons
* @param data * @param data varargs with type schema.Beacon, or single arg null
* @returns {Pass} * @returns {Pass}
*/ */
beacons(...data: schema.Beacon[] | null): this { beacons(resetFlag: null): this;
if (data === null) { beacons(...data: schema.Beacon[]): this
beacons(...args: (schema.Beacon|null)[]){
if (args[0] === null) {
delete this[passProps]["beacons"]; delete this[passProps]["beacons"];
return this; return this;
} }
const valid = processRelevancySet("beacons", data); const valid = processRelevancySet("beacons", args);
if (valid.length) { if (valid.length) {
this[passProps]["beacons"] = valid; this[passProps]["beacons"] = valid;
@@ -302,17 +304,19 @@ export class Pass {
/** /**
* Sets current pass' relevancy through locations * Sets current pass' relevancy through locations
* @param data * @param data varargs with type schema.Location, or single arg null
* @returns {Pass} * @returns {Pass}
*/ */
locations(...data: schema.Location[] | null): this { locations(resetFlag : null) : this;
if (data === null) { locations(...data: schema.Location[]): this;
locations(...args: (schema.Location|null)[]) : this {
if (args[0] === null) {
delete this[passProps]["locations"]; delete this[passProps]["locations"];
return this; return this;
} }
const valid = processRelevancySet("locations", data); const valid = processRelevancySet("locations", args);
if (valid.length) { if (valid.length) {
this[passProps]["locations"] = valid; this[passProps]["locations"] = valid;