New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

explicit-window

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

explicit-window

Converts explicit assignments to window into explicit assignments.

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by20%
Maintainers
1
Weekly downloads
 
Created
Source

explicit-window

A small javascript-to-javascript compiler which converts (some) implicit assignments to window into explicit ones.

This is useful when using js-to-js compilers that wrap your code in a function expression, with code that assigns to window using mechanisms that only do so in the top scope.

It converts:

  • Variable declarations in the top scope.
  • Function declarations in the top scope.

If there is anything I've missed, open up an issue.

Installation

npm install explicit-window

Usage

var explicitWindow = require('explicit-window');

var convertedFileContents = explicitWindow(fileContents);

Tests

The test/unit_cases folder contains a set of inputs and outputs for the compiler. These inputs and outputs are themselves tests. The unit tests test whether the compiler maps each input to the corresponding output, and the integration tests test whether the assertions pass in both the inputs and outputs, when loaded into a browser. This hopefully ensures that the outputs have the same semantics as the inputs.

To run the unit tests, install mocha with

npm install -g mocha

then run mocha.

To run the integration tests, open test/integration/test.html in your browser. The tests pass if no errors are thrown when executing the page. I'll probably find a better way of testing this at sonme point.

Keywords

FAQs

Package last updated on 28 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc