How to use the typechecker.isError function in typechecker

To help you get started, we’ve selected a few typechecker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bevry / envfile / source / index.js View on Github external
function parseFileSync(filePath) {
	// Read
	const data = fs.readFileSync(filePath)

	// Check the result
	if (typeChecker.isError(data)) {
		// An error occured
		return data
	} else {
		// Parse the result
		return parseSync(data.toString())
	}
}

typechecker

Utilities to get and check variable types (isString, isPlainObject, isRegExp, etc)

Artistic-2.0
Latest version published 11 months ago

Package Health Score

70 / 100
Full package analysis