@megatherium/has-property
v1.3.7
Published
Checks if a given object has a specific property.
Downloads
7
Readme
has-property
Checks if a given object has a specific property.
Shortcut to Object.prototype.hasOwnProperty.call(obj, propertyName).
See the whole documentation or the coverage report.
Getting started
Install the module:
$ npm install @megatherium/has-property
Use the module:
import assert from 'assert';
import hasProperty from '@megatherium/has-property';
assert.strictEqual(hasProperty({}, 'foo'), false);
assert.strictEqual(hasProperty({
foo: true,
}), true);
assert.strictEqual(hasProperty({
foo: false,
}), true);
assert.strictEqual(hasProperty({
foo: undefined,
}), true);API (1)
Exports
hasProperty(obj: object, propertyName: string): boolean Checks if a given object has a specific property.
Scripts
The following scripts can be executed using npm run:
buildBuilds the module.build-docsBuilds the documentation.build-sourceBuilds the source code.build-testsBuilds test-cases from jsdoc examples.clearClears the module from a previous build.clear-coverageClears the coverage reports and caches.clear-docsClears the previous documentation build.clear-sourceClears the previous source build.clear-testsClears the generated jsdoc example test files.fixRuns all automated fixes.fix-lintAutomatically fixes linting problems.releaseRuns semantic release. Meant to be only executed by the CI, not by human users.testExecutes all tests.test-coverageGenerates coverage reports from the test results using nyc.test-depsExecutes a depcheck.test-e2eExecutes End-to-End-Tests using cucumber.test-integrationExecutes integration tests using jest.test-lintExecutes linting tests using eslint.test-unitExecutes unit tests using mocha.updateChecks for dependency updates using renovate.
Contribution
See Contribution Guidelines for more details.
