How to use has-own-prop - 9 common examples

To help you get started, we’ve selected a few has-own-prop 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 devconcept / multer-gridfs-storage / test / uploaded-file.spec.js View on Github external
test('uploaded file have the default bucket name pointing to the fs collection', t => {
	const {result} = t.context;
	t.true(hasOwn(result.file, 'bucketName'));
	t.is(result.file.bucketName, 'fs');
});
github devconcept / multer-gridfs-storage / test / uploaded-file.spec.js View on Github external
test('uploaded file have a filename property', t => {
	const {result} = t.context;
	t.true(hasOwn(result.file, 'filename'));
	t.is(typeof result.file.filename, 'string');
	t.regex(result.file.filename, /^[0-9a-f]{32}$/);
});
github devconcept / multer-gridfs-storage / test / uploaded-file.spec.js View on Github external
test('uploaded file have the date of the upload', t => {
	const {result} = t.context;
	t.true(hasOwn(result.file, 'uploadDate'));
	t.true(result.file.uploadDate instanceof Date);
});
github devconcept / multer-gridfs-storage / test / uploaded-file.spec.js View on Github external
test('uploaded file have a size property with the length of the file', t => {
	const {result, size} = t.context;
	t.true(hasOwn(result.file, 'size'));
	t.is(result.file.size, size);
});
github devconcept / multer-gridfs-storage / test / uploaded-file.spec.js View on Github external
test('uploaded file have a metadata property', t => {
	const {result} = t.context;
	t.true(hasOwn(result.file, 'metadata'));
	t.is(result.file.metadata, null);
});
github devconcept / multer-gridfs-storage / test / utils / testutils.js View on Github external
export function closeConnections({db, client}) {
	if (client) {
		if (hasOwn(client, 'readyState') && client.readyState === 1) {
			return client.close();
		}

		if (hasOwn(client, 'isConnected') && client.isConnected()) {
			return client.close();
		}
	} else {
		return db.close();
	}
}
github devconcept / multer-gridfs-storage / test / utils / testutils.js View on Github external
export function closeConnections({db, client}) {
	if (client) {
		if (hasOwn(client, 'readyState') && client.readyState === 1) {
			return client.close();
		}

		if (hasOwn(client, 'isConnected') && client.isConnected()) {
			return client.close();
		}
	} else {
		return db.close();
	}
}
github devconcept / multer-gridfs-storage / test / default-generator.spec.js View on Github external
['fieldname', 'originalname', 'encoding', 'mimetype'].every(k =>
			t.true(hasOwn(file, k))
		);
github devconcept / multer-gridfs-storage / test / default-generator.spec.js View on Github external
		['body', 'query', 'params', 'files'].every(k => t.true(hasOwn(req, k)));
		['fieldname', 'originalname', 'encoding', 'mimetype'].every(k =>

has-own-prop

A safer `.hasOwnProperty()`

MIT
Latest version published 2 years ago

Package Health Score

67 / 100
Full package analysis

Popular has-own-prop functions