'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 at least one element in the `coll` satisfies an async test.22* If any iteratee call returns `true`, the main `callback` is immediately23* called.24*25* @name some26* @static27* @memberOf module:Collections28* @method29* @alias any30* @category Collection31* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.32* @param {AsyncFunction} iteratee - An async truth test to apply to each item33* in the collections in parallel.34* The iteratee should complete with a boolean `result` value.35* Invoked with (item, callback).36* @param {Function} [callback] - A callback which is called as soon as any37* iteratee returns `true`, or after all the iteratee functions have finished.38* Result will be either `true` or `false` depending on the values of the async39* tests. Invoked with (err, result).40* @returns {Promise} a promise, if no callback provided41* @example42*43* // dir1 is a directory that contains file1.txt, file2.txt44* // dir2 is a directory that contains file3.txt, file4.txt45* // dir3 is a directory that contains file5.txt46* // dir4 does not exist47*48* // asynchronous function that checks if a file exists49* function fileExists(file, callback) {50* fs.access(file, fs.constants.F_OK, (err) => {51* callback(null, !err);52* });53* }54*55* // Using callbacks56* async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists,57* function(err, result) {58* console.log(result);59* // true60* // result is true since some file in the list exists61* }62*);63*64* async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists,65* function(err, result) {66* console.log(result);67* // false68* // result is false since none of the files exists69* }70*);71*72* // Using Promises73* async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists)74* .then( result => {75* console.log(result);76* // true77* // result is true since some file in the list exists78* }).catch( err => {79* console.log(err);80* });81*82* async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists)83* .then( result => {84* console.log(result);85* // false86* // result is false since none of the files exists87* }).catch( err => {88* console.log(err);89* });90*91* // Using async/await92* async () => {93* try {94* let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists);95* console.log(result);96* // true97* // result is true since some file in the list exists98* }99* catch (err) {100* console.log(err);101* }102* }103*104* async () => {105* try {106* let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists);107* console.log(result);108* // false109* // result is false since none of the files exists110* }111* catch (err) {112* console.log(err);113* }114* }115*116*/117function some(coll, iteratee, callback) {118return (0, _createTester2.default)(Boolean, res => res)(_eachOf2.default, coll, iteratee, callback);119}120exports.default = (0, _awaitify2.default)(some, 3);121module.exports = exports['default'];122123