Skip to content

Commit

Permalink
Replaced tabs with spaces inside code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
cowwoc committed Nov 29, 2023
1 parent 6455c81 commit bf850e2
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,29 @@ class Address

class PublicAPI
{
constructor(name: string | null, age: number, address: Address | undefined)
{
// To validate user input, cast them to "unknown" prior to type-checks.
requireThat(name as unknown, "name").isString().length().isBetween(1, 30);
requireThat(age as unknown, "age").isNumber().isBetween(18, 30);

// Methods that conduct runtime type-checks, such as isString() or isNotNull(), update the
// compile-time type returned by getActual().
const nameIsString: string = requireThat(name as unknown, "name").isString().getActual();
const address: Address = requireThat(address as unknown, "address").isInstance(Address).getActual();
}
constructor(name: string | null, age: number, address: Address | undefined)
{
// To validate user input, cast them to "unknown" prior to type-checks.
requireThat(name as unknown, "name").isString().length().isBetween(1, 30);
requireThat(age as unknown, "age").isNumber().isBetween(18, 30);

// Methods that conduct runtime type-checks, such as isString() or isNotNull(), update the
// compile-time type returned by getActual().
const nameIsString: string = requireThat(name as unknown, "name").isString().getActual();
const address: Address = requireThat(address as unknown, "address").isInstance(Address).getActual();
}
}

class PrivateAPI
{
public static toCamelCase(text): string
{
// Trusted input does not need to be casted to "unknown". The input type will be inferred
// and runtime checks will be skipped. Notice the lack of isString() or isNumber() invocations
// in the following code.
assertThat(r => r.requireThat(name, "name").length().isBetween(1, 30));
assertThat(r => r.requireThat(age, "age").isBetween(18, 30));
}
public static toCamelCase(text): string
{
// Trusted input does not need to be casted to "unknown". The input type will be inferred
// and runtime checks will be skipped. Notice the lack of isString() or isNumber() invocations
// in the following code.
assertThat(r => r.requireThat(name, "name").length().isBetween(1, 30));
assertThat(r => r.requireThat(age, "age").isBetween(18, 30));
}
}
```

Expand Down

0 comments on commit bf850e2

Please sign in to comment.