Skip to content

Commit 5b7bd28

Browse files
committed
Fix some minor stylistics and a typo
1 parent 3a0a98a commit 5b7bd28

File tree

3 files changed

+68
-69
lines changed

3 files changed

+68
-69
lines changed

.doclets.yml

-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ dir: src
33
packageJson: package.json
44

55
articles:
6-
76
- Overview: readme.md

readme.md

+65-65
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This foreach partial automagically detects whether the callback function expects
1515
similar to [PHP's foreach construct](http://php.net/manual/en/control-structures.foreach.php)
1616
by **value** or **key-value** distinction.
1717

18-
Works **compressed JavaScript code** too, also compatible with **ECMAScript 6 arrow functions**.
18+
Works with **compressed JavaScript code** too, also compatible with **ECMAScript 6 arrow functions**.
1919

2020
## Install
2121

@@ -33,110 +33,110 @@ The actual usage of the partial is the same across all environment.
3333
- AMD (e.g.: RequireJS)
3434

3535
```javascript
36-
define(['js-partial-foreach'], function(foreach) {
37-
// you can now use foreach
38-
});
36+
define(['js-partial-foreach'], function(foreach) {
37+
// you can now use foreach
38+
});
3939
```
4040

4141
- CommonJS (e.g.: NodeJS)
4242

4343
```javascript
44-
var foreach = require('js-partial-foreach');
45-
46-
// you can now use foreach
44+
var foreach = require('js-partial-foreach');
45+
46+
// you can now use foreach
4747
```
4848

4949
- Browser
5050

5151
```javascript
52-
// load the source from "node_modules/js-partial-foreach/dist/js-partial-foreach.js" - for development
53-
// or from "node_modules/js-partial-foreach/dist/js-partial-foreach.min.js" - for production
52+
// load the source from "node_modules/js-partial-foreach/dist/js-partial-foreach.js" - for development
53+
// or from "node_modules/js-partial-foreach/dist/js-partial-foreach.min.js" - for production
5454

55-
var foreach = js_partial_foreach; // it is available in the global namespace
56-
57-
// you can now use foreach
55+
var foreach = js_partial_foreach; // it is available in the global namespace
56+
57+
// you can now use foreach
5858
```
5959

6060
## Usage - After Initialization
6161

6262
- With arrays
6363

6464
```javascript
65-
var array = [1, 2, 3, 4, 5];
65+
var array = [1, 2, 3, 4, 5];
6666

67-
foreach(
68-
array,
69-
function(value) {
70-
console.log(value); // 1 .. 5
71-
}
72-
);
67+
foreach(
68+
array,
69+
function(value) {
70+
console.log(value); // 1 .. 5
71+
}
72+
);
7373

74-
foreach(
75-
array,
76-
function(key, value) {
77-
console.log(key + ':' + value); // 0:1 .. 4:5
78-
}
79-
);
74+
foreach(
75+
array,
76+
function(key, value) {
77+
console.log(key + ':' + value); // 0:1 .. 4:5
78+
}
79+
);
8080
```
8181

8282
- With objects
8383

8484
```javascript
85-
// for objects
86-
var object = {
87-
a : 1,
88-
b : 2,
89-
c : 3,
90-
d : 4,
91-
e : 5
92-
};
85+
// for objects
86+
var object = {
87+
a : 1,
88+
b : 2,
89+
c : 3,
90+
d : 4,
91+
e : 5
92+
};
9393

94-
foreach(
95-
object,
96-
function(value) {
97-
console.log(value); // 1 .. 5
98-
}
99-
);
94+
foreach(
95+
object,
96+
function(value) {
97+
console.log(value); // 1 .. 5
98+
}
99+
);
100100

101-
foreach(
102-
object,
103-
function(key, value) {
104-
console.log(key + ':' + value); // a:1 .. e:5
105-
}
106-
);
101+
foreach(
102+
object,
103+
function(key, value) {
104+
console.log(key + ':' + value); // a:1 .. e:5
105+
}
106+
);
107107
```
108108

109109
- With ES6 arrow functions
110110

111111
```javascript
112-
var array = [1, 2, 3, 4, 5];
112+
var array = [1, 2, 3, 4, 5];
113113

114-
foreach(
115-
array,
116-
(value) => {
117-
console.log(value); // 1 .. 5
118-
}
119-
);
114+
foreach(
115+
array,
116+
(value) => {
117+
console.log(value); // 1 .. 5
118+
}
119+
);
120120

121-
foreach(
122-
array,
123-
(key, value) => {
124-
console.log(key + ':' + value); // 0:1 .. 4:5
125-
}
126-
);
121+
foreach(
122+
array,
123+
(key, value) => {
124+
console.log(key + ':' + value); // 0:1 .. 4:5
125+
}
126+
);
127127
```
128128

129129
- With strings
130130

131131
```javascript
132-
var string = 'abcdefgh';
132+
var string = 'abcdefgh';
133133

134-
foreach(
135-
string,
136-
function(char) {
137-
console.log(char); // 'a' .. 'h'
138-
}
139-
);
134+
foreach(
135+
string,
136+
function(char) {
137+
console.log(char); // 'a' .. 'h'
138+
}
139+
);
140140
```
141141

142142
## Documentation

src/js-partial-foreach.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,9 @@
352352
* @example
353353
* var options = foreach.getOptions();
354354
* // options now will contain:
355-
* // options.checkArguments
356-
* // options.checkOwnProperty
357-
* // options.castArrayIndex
355+
* // - options.checkArguments
356+
* // - options.checkOwnProperty
357+
* // - options.castArrayIndex
358358
*/
359359
foreach.getOptions = function() {
360360
return processOptions();

0 commit comments

Comments
 (0)