Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 16, 2024 via pnpm

object-keys 1.1.1

An Object.keys replacement, in case Object.keys is not available. From https://github.com/es-shims/es5-shim
Package summary
Share
0
issues
1
license
1
MIT
Package created
29 Mar 2013
Version published
7 Apr 2019
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
object-keys@1.1.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of object-keys 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does object-keys do?

The npm package "object-keys" serves as a replacement for Object.keys method in JavaScript, in cases where Object.keys is not accessible or available. This shim implementation is taken directly from es5-shim, with additional modifications, including some from lodash.

How do you use object-keys?

To use object-keys, initially, you will need to install the module using npm with the command npm install object-keys. After the module is successfully installed, you can require it in your JavaScript file.

Here is a basic usage example:

var keys = require('object-keys');
var assert = require('assert');
var obj = {
	a: true,
	b: true,
	c: true
};

assert.deepEqual(keys(obj), ['a', 'b', 'c']);

In this example, the keys variable holds the function imported from object-keys, and it's used to get the keys from the obj. The assert.deepEqual function is used to verify that the keys received match the expected ones: a, b, and c.

Also, the package allows two additional usage cases demonstrating its purpose as a shim. If the native Object.keys method is not present or is present, you can use it as follows:

When Object.keys is not present:

var keys = require('object-keys');
var assert = require('assert');
delete Object.keys; // Object.keys is not present
var shimmedKeys = keys.shim();
assert.equal(shimmedKeys, keys);
assert.deepEqual(Object.keys(obj), keys(obj));

When Object.keys is present:

var keys = require('object-keys');
var assert = require('assert');
var shimmedKeys = keys.shim(); // Object.keys is present
assert.equal(shimmedKeys, Object.keys);
assert.deepEqual(Object.keys(obj), keys(obj));

Where are the object-keys docs?

For comprehensive documentation about the object-keys npm package, you can simply visit the GitHub repository linked in the package's readme file: https://github.com/ljharb/object-keys. All usage information, along with the source code and test examples, can be found at this location. Apart from the information found in the readme, you can also look into the source code for more detailed insights.