identity-obj-proxy
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
harmony-reflect | 1.6.2 | 20.15 kB | (Apache-2.0 OR MPL-1.1) | prod |
Identity-obj-proxy is a JavaScript package that creates an identity object using ES6 proxies. It's specifically designed to be useful for testing trivial webpack imports. When using tools like Jest for testing, you can mock this object for imported CSS modules, meaning all your className
lookups on the imported styles
object will be just returned as they are read in.
You can install identity-obj-proxy by running npm install identity-obj-proxy
in your project directory. Usage is straightforward as the module exports a proxy object that returns the property name as the value for any given property. Here is a quick usage demonstration:
import idObj from 'identity-obj-proxy';
console.log(idObj.foo); // This will output 'foo'
console.log(idObj.bar); // This will output 'bar'
console.log(idObj[1]); // This will output '1'
Just remember that if you are using Node.js versions v5.*
and v4.*
you will need to use the node --harmony_proxies
flag as this package uses ES6 proxies.
As for the documentation of identity-obj-proxy, you can find more detailed information in the README file on the GitHub repository of the package. The documentation provides an explanation of its purpose, requirements, an example demonstrating its use, and additional resources related to the project.