BVB Source Codes

prettier Show test_imports_are_frozen.js Source code

Return Download prettier: download test_imports_are_frozen.js Source code - Download prettier Source code - Type:.js
  1. /* @flow */
  2.  
  3. //
  4. // Imports
  5. //
  6.  
  7. // CommonJS module
  8. import * as DefaultA from "A";
  9. DefaultA.numberValue1 = 123; // Error: DefaultA is frozen
  10.  
  11. // ES6 module
  12. import * as ES6_Named1 from "ES6_Named1";
  13. ES6_Named1.varDeclNumber1 = 123; // Error: ES6_Named1 is frozen
  14.  
  15. // CommonJS module that clobbers module.exports
  16. import * as CommonJS_Star from "CommonJS_Clobbering_Lit";
  17. CommonJS_Star.numberValue1 = 123; // Error: frozen
  18. CommonJS_Star.default.numberValue1 = 123; // ok
  19.  
  20. import CommonJS_Clobbering_Lit from "CommonJS_Clobbering_Lit";
  21. CommonJS_Clobbering_Lit.numberValue1 = 123; // ok
  22.  
  23. // CommonJS module that clobbers module.exports with a frozen object
  24. import * as CommonJS_Frozen_Star from "CommonJS_Clobbering_Frozen";
  25. CommonJS_Frozen_Star.numberValue1 = 123; // Error: frozen
  26. CommonJS_Frozen_Star.default.numberValue1 = 123; // Error: frozen
  27.  
  28. import CommonJS_Clobbering_Frozen from "CommonJS_Clobbering_Frozen";
  29. CommonJS_Clobbering_Frozen.numberValue1 = 123; // Error: exports are frozen
  30.  
  31.  
  32. //
  33. // Requires
  34. //
  35.  
  36. function testRequires() {
  37.   // CommonJS module
  38.   var DefaultA = require("A");
  39.   DefaultA.numberValue1 = 123; // ok, not frozen by default
  40.  
  41.   // ES6 module
  42.   var ES6_Named1 = require("ES6_Named1");
  43.   ES6_Named1.numberValue = 123; // error, es6 exports are frozen
  44.  
  45.   // CommonJS module that clobbers module.exports
  46.   var CommonJS_Star = require("CommonJS_Clobbering_Lit");
  47.   CommonJS_Star.numberValue1 = 123; // ok, not frozen by default
  48.  
  49.   // CommonJS module that clobbers module.exports with a frozen object
  50.   var CommonJS_Frozen_Star = require("CommonJS_Clobbering_Frozen");
  51.   CommonJS_Frozen_Star.numberValue1 = 123; // Error: frozen
  52. }
  53.  
downloadtest_imports_are_frozen.js Source code - Download prettier Source code
Related Source Codes/Software:
storybook - 2017-06-07
ionicons - The premium icon font for Ionic ... 2017-06-07
AsyncDisplayKit - Smooth asynchronous user interfaces for iOS apps. ... 2017-06-07
lottie-android - Render After Effects animations natively on Androi... 2017-06-07
parse-server - Parse-compatible API server module for Node/Expres... 2017-06-07
inferno - An extremely fast, React-like JavaScript library f... 2017-06-08
guetzli - Perceptual JPEG encoder 2017-06-08
cs-video-courses - List of Computer Science courses with video lectur... 2017-06-08
interviews - Everything you need to know to get the job. 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top