'use strict';12Object.defineProperty(exports, "__esModule", {3value: true4});56var _createTester = require('./internal/createTester.js');78var _createTester2 = _interopRequireDefault(_createTester);910var _eachOf = require('./eachOf.js');1112var _eachOf2 = _interopRequireDefault(_eachOf);1314var _awaitify = require('./internal/awaitify.js');1516var _awaitify2 = _interopRequireDefault(_awaitify);1718function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }1920/**21* Returns `true` if every element in `coll` satisfies an async test. If any22* iteratee call returns `false`, the main `callback` is immediately called.23*24* @name every25* @static26* @memberOf module:Collections27* @method28* @alias all29* @category Collection30* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.31* @param {AsyncFunction} iteratee - An async truth test to apply to each item32* in the collection in parallel.33* The iteratee must complete with a boolean result value.34* Invoked with (item, callback).35* @param {Function} [callback] - A callback which is called after all the36* `iteratee` functions have finished. Result will be either `true` or `false`37* depending on the values of the async tests. Invoked with (err, result).38* @returns {Promise} a promise, if no callback provided39* @example40*41* // dir1 is a directory that contains file1.txt, file2.txt42* // dir2 is a directory that contains file3.txt, file4.txt43* // dir3 is a directory that contains file5.txt44* // dir4 does not exist45*46* const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file5.txt'];47* const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];48*49* // asynchronous function that checks if a file exists50* function fileExists(file, callback) {51* fs.access(file, fs.constants.F_OK, (err) => {52* callback(null, !err);53* });54* }55*56* // Using callbacks57* async.every(fileList, fileExists, function(err, result) {58* console.log(result);59* // true60* // result is true since every file exists61* });62*63* async.every(withMissingFileList, fileExists, function(err, result) {64* console.log(result);65* // false66* // result is false since NOT every file exists67* });68*69* // Using Promises70* async.every(fileList, fileExists)71* .then( result => {72* console.log(result);73* // true74* // result is true since every file exists75* }).catch( err => {76* console.log(err);77* });78*79* async.every(withMissingFileList, fileExists)80* .then( result => {81* console.log(result);82* // false83* // result is false since NOT every file exists84* }).catch( err => {85* console.log(err);86* });87*88* // Using async/await89* async () => {90* try {91* let result = await async.every(fileList, fileExists);92* console.log(result);93* // true94* // result is true since every file exists95* }96* catch (err) {97* console.log(err);98* }99* }100*101* async () => {102* try {103* let result = await async.every(withMissingFileList, fileExists);104* console.log(result);105* // false106* // result is false since NOT every file exists107* }108* catch (err) {109* console.log(err);110* }111* }112*113*/114function every(coll, iteratee, callback) {115return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOf2.default, coll, iteratee, callback);116}117exports.default = (0, _awaitify2.default)(every, 3);118module.exports = exports['default'];119120