ciam-commons
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -1,2 +0,1 @@ | ||
/// <reference types="screeps" /> | ||
export declare namespace Check { | ||
@@ -58,2 +57,9 @@ const objectIdRegex: RegExp; | ||
} | ||
class Flag extends String { | ||
isWildcard: boolean; | ||
keys: Array<string>; | ||
constructor(value: string); | ||
static validate(value: string | Flag): Flag; | ||
equals(other: Flag): boolean; | ||
} | ||
} |
@@ -27,1 +27,23 @@ export var Check; | ||
})(Check || (Check = {})); | ||
export var Model; | ||
(function (Model) { | ||
// Our lord an savior Ash has come to bless us | ||
class Flag extends String { | ||
constructor(value) { | ||
Check.flag(value); | ||
super(value); | ||
this.isWildcard = value == '*' || value.endsWith('.*'); | ||
this.keys = value.split('.'); | ||
} | ||
static validate(value) { | ||
if (!(value instanceof Flag)) { | ||
return new Flag(value); | ||
} | ||
return value; | ||
} | ||
equals(other) { | ||
return this.toString() == other.toString(); | ||
} | ||
} | ||
Model.Flag = Flag; | ||
})(Model || (Model = {})); |
{ | ||
"name": "ciam-commons", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Common types and functions for CIAM", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -86,2 +86,28 @@ export namespace Check { | ||
// Our lord an savior Ash has come to bless us | ||
export class Flag extends String { | ||
isWildcard: boolean; | ||
keys: Array<string>; | ||
constructor(value: string) { | ||
Check.flag(value); | ||
super(value); | ||
this.isWildcard = value == '*' || value.endsWith('.*'); | ||
this.keys = value.split('.'); | ||
} | ||
public static validate(value: string | Flag): Flag { | ||
if (!(value instanceof Flag)) { | ||
return new Flag(value); | ||
} | ||
return value; | ||
} | ||
equals(other: Flag): boolean { | ||
return this.toString() == other.toString(); | ||
} | ||
} | ||
} |
8894
215