mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-11 07:08:07 -05:00
Merge branch 'master' of github.com:airbnb/javascript
* 'master' of github.com:airbnb/javascript: capitalizing types that are constructors Switched modules to bang-style.
This commit is contained in:
17
README.md
17
README.md
@@ -37,9 +37,9 @@
|
||||
|
||||
- **Primitives**: When you access a primitive type you work directly on its value
|
||||
|
||||
+ `string`
|
||||
+ `number`
|
||||
+ `boolean`
|
||||
+ `String`
|
||||
+ `Number`
|
||||
+ `Boolean`
|
||||
+ `null`
|
||||
+ `undefined`
|
||||
|
||||
@@ -53,9 +53,9 @@
|
||||
```
|
||||
- **Complex**: When you access a complex type you work on a reference to its value
|
||||
|
||||
+ `object`
|
||||
+ `array`
|
||||
+ `function`
|
||||
+ `Object`
|
||||
+ `Array`
|
||||
+ `Function`
|
||||
|
||||
```javascript
|
||||
var foo = [1, 2],
|
||||
@@ -1087,6 +1087,7 @@
|
||||
|
||||
## <a name='modules'>Modules</a>
|
||||
|
||||
- The module should start with a `!`. This ensures that if a malformed module forgets to include a final semicolon there aren't errors in production when the scripts get concatenated.
|
||||
- The file should be named with camelCase, live in a folder with the same name, and match the name of the single export.
|
||||
- Add a method called noConflict() that sets the exported module to the previous version.
|
||||
- Always declare `'use strict;'` at the top of the module.
|
||||
@@ -1094,7 +1095,7 @@
|
||||
```javascript
|
||||
// fancyInput/fancyInput.js
|
||||
|
||||
(function(global) {
|
||||
!function(global) {
|
||||
'use strict';
|
||||
|
||||
var previousFancyInput = global.FancyInput;
|
||||
@@ -1108,7 +1109,7 @@
|
||||
};
|
||||
|
||||
global.FancyInput = FancyInput;
|
||||
})(this);
|
||||
}(this);
|
||||
```
|
||||
|
||||
**[[⬆]](#TOC)**
|
||||
|
||||
Reference in New Issue
Block a user