How to use the typechecker.isEmptyPlainObject 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 / boundation / source / package.js View on Github external
return result
		})
	} else {
		delete packageData.editions
	}

	// trim empty keys
	for (const key in packageData) {
		if (packageData.hasOwnProperty(key)) {
			const value = packageData[key]
			if (typeChecker.isArray(value) && typeChecker.isEmptyArray(value)) {
				console.log(`trim: array: package.json:${key}`)
				delete packageData[key]
			} else if (
				typeChecker.isPlainObject(value) &&
				typeChecker.isEmptyPlainObject(value)
			) {
				console.log(`trim: empty: package.json:${key}`)
				delete packageData[key]
			} else if (value == null || value === '') {
				console.log(`trim: null|'': package.json:${key}`)
				delete packageData[key]
			}
		}
	}

	// ---------------------------------
	// Badges

	// set travisTLD if it is com
	// we don't set it explicity to org
	// so that when the official migration happens, there will be no manual changes

typechecker

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

Artistic-2.0
Latest version published 7 months ago

Package Health Score

70 / 100
Full package analysis