Wbs
This class holds a WBS (Work Breakdown Structure) value (e.g., '1.2.1'). This class ensures that such values compare correctly, for example, that '1.2' is less than '1.10' (which do not compare that way as simple text).
Properties
1
Properties
1The WBS value
Functions
5
Functions
5Appends a sub-level WBS value to this WBS code and returns a Wbs instance for it.
| Parameter | Type | Description |
|---|---|---|
value | String | Number |
Compares two WBS values, returning 0 if equal, -1 if lhs is less than rhs, or 1 if lhsis greater thanrhs`.
| Parameter | Type | Description |
|---|---|---|
lhs | String | Wbs | |
rhs | String | Wbs |
Returns a Wbs instance given a value. If the value is already a Wbs object, it is returned. Otherwise,
a new Wbs is created. If value is null or undefined, that value is returned.
| Parameter | Type | Description |
|---|---|---|
value | String | Number | Wbs |
Returns truthy value if this Wbs equals the passed value.
| Parameter | Type | Description |
|---|---|---|
value | String | Wbs |
Compares this WBS value with a specified pattern, returning true if they match. If the pattern is simply a
sequence of digits and decimal points (e.g., "1.2"), it is a match if it is a substring of this WBS code (e.g.,
"3.1.2.4"). If the pattern starts with * (e.g., "*.1.2"), it is a match if this WBS code ends with the text
following the * (e.g., "4.3.1.2"). If the pattern ends with *, it is a match if this WBS code starts with
the text up to the *.
Some examples:
console.log(Wbs.from('1.2.3.4').match('2.3'));
> true
console.log(Wbs.from('1.2.3.4').match('*.4'));
> true
console.log(Wbs.from('1.2.3.4').match('1.2.*'));
> true
console.log(Wbs.from('1.2.3.4').match('2.4'));
> false
console.log(Wbs.from('1.2.3.4').match('*.3'));
> false
console.log(Wbs.from('1.2.3.4').match('2.*'));
> false
| Parameter | Type | Description |
|---|---|---|
pattern | String | A partial WBS code (e.g., "1.2"), optionally starting or ending with |