0.1.1 • Published 11 months ago

@satisfactory-dev/predicates.ts v0.1.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
11 months ago

Coverage Status Workflow Status

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