@megatherium/has-property
v1.3.7
Published
Checks if a given object has a specific property.
Downloads
1
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
:
build
Builds the module.build-docs
Builds the documentation.build-source
Builds the source code.build-tests
Builds test-cases from jsdoc examples.clear
Clears the module from a previous build.clear-coverage
Clears the coverage reports and caches.clear-docs
Clears the previous documentation build.clear-source
Clears the previous source build.clear-tests
Clears the generated jsdoc example test files.fix
Runs all automated fixes.fix-lint
Automatically fixes linting problems.release
Runs semantic release. Meant to be only executed by the CI, not by human users.test
Executes all tests.test-coverage
Generates coverage reports from the test results using nyc.test-deps
Executes a depcheck.test-e2e
Executes End-to-End-Tests using cucumber.test-integration
Executes integration tests using jest.test-lint
Executes linting tests using eslint.test-unit
Executes unit tests using mocha.update
Checks for dependency updates using renovate.
Contribution
See Contribution Guidelines for more details.