Skip to content

Commit bd4dfb3

Browse files
docs(README.md): update numberBetween() and stringOfLength().
1 parent 481a20a commit bd4dfb3

1 file changed

Lines changed: 24 additions & 29 deletions

File tree

README.md

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2691,35 +2691,29 @@ Expects provided `value` to be a [`number`][js-number] type or an instance of a
26912691
```typescript
26922692
public numberBetween<Min extends number, Max extends number>(
26932693
value: any,
2694-
range: {
2695-
min?: Min;
2696-
max?: Max;
2697-
},
2694+
min: Min,
2695+
max: Max,
26982696
expected: jasmine.Expected<boolean> = true,
26992697
expectationFailOutput: any = `${this.expectationFailOutput} ${
27002698
this.getNot() === true ? `not` : ``
2701-
} be a \`number\` type or an instance of a \`Number\` between the range of ${
2702-
range?.min
2703-
} and ${range?.max}`
2699+
} be a \`number\` type or an instance of a \`Number\` between the range of ${min} and ${max}`
27042700
): this {
2705-
this.toBe(is.numberBetween(value, range), expected, expectationFailOutput);
2701+
this.toBe(
2702+
is.numberBetween(value, min, max),
2703+
expected,
2704+
expectationFailOutput
2705+
);
27062706
return this;
27072707
}
27082708
```
27092709

2710-
**Generic type variables:**
2711-
2712-
| Name | Default value | Description |
2713-
| :-------- | :------------------------ | :---------- |
2714-
| `Min` | From the `min` of `range` | A generic type variable `Min` constrained by the [`number`][ts-number] type, by default of value captured from optional `min` of the provided `range` that indicates the **minimum** range of the provided `value` via the return type `value is NumberBetween<Min, Max, Type>`. |
2715-
| `Max` | From the `max` of `range` | A generic type variable `Max` constrained by the [`number`][ts-number] type, by default of value captured from optional `max` of the provided `range` that indicates the **maximum** range of the provided `value` via the return type `value is NumberBetween<Min, Max, Type>`. |
2716-
27172710
**Parameters:**
27182711

27192712
| Name: type | Description |
27202713
| :------------------------------------ | :---------- |
27212714
| `value: any` | The `value` of any type that is checked against a [`number`][js-number] type or an instance of a [`Number`][js-number] within the specified **range** and the result of its check is passed to the [`expect()`][jasmine-expect] function of jasmine. |
2722-
| `range: { min?: Min, max?: Max }` | An [`object`][js-object] of optional **minimum** and **maximum** `range` of a given `value`. |
2715+
| `min: Min` | The **minimum** range of generic type variable `Min` of the given `value`. |
2716+
| `max: Max` | The **maximum** range of generic type variable `Max` of the given `value`. |
27232717
| `expected: jasmine.Expected<boolean>` | The expected value of a [`boolean`][js-boolean] to compare against the result of the `value` check that is passed to the `toBe()` method of [`jasmine.Matchers`][jasmine-matchers]. |
27242718
| `expectationFailOutput: any` | An additional message when the matcher fails, by default, states the `value` should be (or not) a [`number`][js-number] type or an instance of a [`Number`][js-number] between the range of **minimum** and **maximum**. |
27252719

@@ -2752,10 +2746,10 @@ testing.describe('Expects provided value', () => {
27522746

27532747
testing.describe('to be', () =>
27542748
testing.it(`\`number\` between 26 to 28`, () =>
2755-
toBe.numberBetween(isNumberBetween, {min, max})))
2749+
toBe.numberBetween(isNumberBetween, min, max)))
27562750
.describe('not to be', () =>
27572751
testing.it(`\`number\` between 26 to 28`, () =>
2758-
toBe.not.numberBetween(127, {min, max})));
2752+
toBe.not.numberBetween(127, min, max)));
27592753
});
27602754
```
27612755

@@ -3368,18 +3362,18 @@ Expects provided `value` to be a [`string`][js-string] type or an instance of a
33683362
```typescript
33693363
public stringOfLength<Min extends number, Max extends number>(
33703364
value: any,
3371-
length: {
3372-
min: Min;
3373-
max: Max;
3374-
},
3365+
min: Min,
3366+
max: Max,
33753367
expected: jasmine.Expected<boolean> = true,
33763368
expectationFailOutput: any = `${this.expectationFailOutput} ${
33773369
this.getNot() === true ? `not` : ``
3378-
} be a \`string\` type or an instance of a \`String\` of the \`length\` between the given ${
3379-
length?.min
3380-
} and ${length?.max}`
3370+
} be a \`string\` type or an instance of a \`String\` of the \`length\` between the given ${min} and ${max}`
33813371
): this {
3382-
this.toBe(is.stringLength(value, length), expected, expectationFailOutput);
3372+
this.toBe(
3373+
is.stringLength(value, min, max),
3374+
expected,
3375+
expectationFailOutput
3376+
);
33833377
return this;
33843378
}
33853379
```
@@ -3389,7 +3383,8 @@ public stringOfLength<Min extends number, Max extends number>(
33893383
| Name: type | Description |
33903384
| :------------------------------------ | :---------- |
33913385
| `value: any` | The `value` of any type that is checked against a [`string`][js-string] type or an instance of a [`String`][js-string] of the specified **length** and the result of its check is passed to the [`expect()`][jasmine-expect] function of jasmine. |
3392-
| `length: { min: Min, max: Max }` | An [`object`][js-object] of optional **minimum** and **maximum** `length` of the given `value`. |
3386+
| `min: Min` | The **minimum** length of generic type variable `Min` of a given `value`. |
3387+
| `max: Max` | The **maximum** length of generic type variable `Max` of a given `value`. |
33933388
| `expected: jasmine.Expected<boolean>` | The expected value of a [`boolean`][js-boolean] to compare against the result of the `value` check that is passed to the `toBe()` method of [`jasmine.Matchers`][jasmine-matchers]. |
33943389
| `expectationFailOutput: any` | An additional message when the matcher fails, by default, states the `value` should be (or not) a [`string`][js-string] type or an instance of a [`String`][js-string] of the **length** between the given **minimum** and **maximum**. |
33953390

@@ -3421,8 +3416,8 @@ testing.describe('Expects provided value', () => {
34213416
});
34223417
testing.describe('to be or not to be', () => {
34233418
testing.it(`a \`string\` between the given length`, () =>
3424-
toBe.stringOfLength(string, {min, max}).
3425-
not.stringOfLength(undefined, {min, max}));
3419+
toBe.stringOfLength(string, min, max).
3420+
not.stringOfLength(undefined, min, max));
34263421
});
34273422
});
34283423
```

0 commit comments

Comments
 (0)