Skip to content

Commit 02a213d

Browse files
committed
Added test suite using webpack-mocha.
Corrected error in documentation of .forEach() (resolved array is same as initial array). Fixed second argument in .forEach and .filter (affects map, mapFilter) - i or attr values correctly passed
1 parent 40b9a9b commit 02a213d

File tree

17 files changed

+4708
-34
lines changed

17 files changed

+4708
-34
lines changed

.eslintrc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"parser": "babel-eslint",
3+
"extends": [
4+
"standard",
5+
"standard-react"
6+
],
7+
"plugins": [
8+
"babel",
9+
"react",
10+
"promise"
11+
],
12+
"env": {
13+
"browser": true
14+
},
15+
"globals": {
16+
"__DEV__": false,
17+
"__TEST__": false,
18+
"__PROD__": false,
19+
"__COVERAGE__": false
20+
},
21+
"rules": {
22+
"key-spacing": "off",
23+
"jsx-quotes": [
24+
2,
25+
"prefer-double"
26+
],
27+
"space-before-function-paren": [
28+
"error",
29+
"never"
30+
],
31+
"max-len": [
32+
2,
33+
120,
34+
2
35+
],
36+
37+
"comma-dangle": "off"
38+
}
39+
}

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"printWidth": 100,
3+
"parser": "flow",
4+
"bracketSpacing":true,
5+
"semi":false,
6+
"singleQuote":true
7+
}

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ am(Promise.resolve([45, 67]))
241241

242242
*fn can be a normal function (synchronous operations) or a generator (asynchronous operations)*
243243

244-
*Filter can be applies to objects as well as arrays
244+
*Filter can be applied to objects and other entitites as well as arrays
245245

246246
```
247247
@@ -306,6 +306,8 @@ am([3, 4, 5]).mapFilter(function (value, i) {
306306

307307
*fn can be a normal function (synchronous operations) or a generator (asynchronous operations)*
308308

309+
forEach returns an extended Promise resolving to the initial array or object
310+
309311

310312
*synchronous*
311313

@@ -316,7 +318,10 @@ am([34, 56, 78]).forEach(function (value, i) {
316318
}).log();
317319
318320
// logs
319-
// 34 0, 56 1, 78 2
321+
// 34 0
322+
// 56 1
323+
// 78 2
324+
// [34, 56, 78]
320325
321326
```
322327

@@ -325,11 +330,13 @@ am([34, 56, 78]).forEach(function (value, i) {
325330

326331
```
327332
am([34, 56, 78]).forEach(function* (value, i) {
328-
return yield am.resolve(2 * value);
333+
console.log(yield am.resolve(2 * value),i);
329334
}).log();
330335
331336
// logs
332-
// [64, 112, 156]
337+
// 68 0
338+
// 112 1
339+
// 156 2
333340
334341
335342
```

changes.MD

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
### Version 0.4
2+
3+
1. Changed behaviour of tolerant in map() to push passing items rather than assign to original index (same behaviour as .mapFilter() )
4+
5+
2. Fixed second argument in mapFilter (i or attr values passed)
6+
7+
3. Added test suite using webpack-mocha
8+
9+
4. Removed ';' from statement ends
10+
11+
5. Corrected error in .forEach() documentation (resolved array is same as initial array)
12+

0 commit comments

Comments
 (0)