@satisfactory-dev/predicates.ts
v0.1.1
Published
typescript predicates
Downloads
111
Readme
Installation
npm install --save @satisfactory-dev/predicates.ts
Usage
import {
is_string,
object_only_has_that_property,
} from '@satisfactory-dev/predicates.ts';
export function foo(maybe: unknown): maybe is {foo: string} {
return object_only_has_that_property(maybe, 'foo', is_string);
}
foo({foo: 1}); // would return false
foo({foo: 'bar'}); // would return true
foo({foo: 'bar', baz: 1}); // would return false