-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(document): remove
async.each()
dependencies
Re: #8073
- Loading branch information
Showing
4 changed files
with
29 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
module.exports = function each(arr, cb, done) { | ||
if (arr.length === 0) { | ||
return done(); | ||
} | ||
|
||
let remaining = arr.length; | ||
let err = null; | ||
for (const v of arr) { | ||
cb(v, function(_err) { | ||
if (err != null) { | ||
return; | ||
} | ||
if (_err != null) { | ||
err = _err; | ||
return done(err); | ||
} | ||
|
||
if (--remaining <= 0) { | ||
return done(); | ||
} | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
'use strict'; | ||
|
||
const each = require('async/each'); | ||
const each = require('../helpers/each'); | ||
|
||
/*! | ||
* ignore | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7903,7 +7903,7 @@ describe('document', function() { | |
} | ||
} | ||
}); | ||
|
||
const schema = new Schema({ | ||
items: [itemArray] | ||
}); | ||
|