Sha256: 1fd17223681df93d62770ccb6c0663c5a6db392c85ba5465b773c94819811d60

Contents?: true

Size: 512 Bytes

Versions: 77

Compression:

Stored size: 512 Bytes

Contents

'use strict';
const path = require('path');
const pathExists = require('path-exists');
const pLocate = require('p-locate');

module.exports = (iterable, opts) => {
	opts = Object.assign({
		cwd: process.cwd()
	}, opts);

	return pLocate(iterable, el => pathExists(path.resolve(opts.cwd, el)), opts);
};

module.exports.sync = (iterable, opts) => {
	opts = Object.assign({
		cwd: process.cwd()
	}, opts);

	for (const el of iterable) {
		if (pathExists.sync(path.resolve(opts.cwd, el))) {
			return el;
		}
	}
};

Version data entries

77 entries across 77 versions & 9 rubygems

Version Path
trusty-cms-5.0.7 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-5.0.6 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-5.0.5 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-5.0.4 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-5.0.3 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-5.0.2 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-5.0.1 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-4.3.5 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-5.0.0 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-4.3.4 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-4.3.3 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-4.3.2 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-4.3.1 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-4.3 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-4.2.3 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-4.2.2 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-4.2.1 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-4.2 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-4.1.9 node_modules/pkg-up/node_modules/locate-path/index.js
trusty-cms-4.1.8 node_modules/pkg-up/node_modules/locate-path/index.js