/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var IS_WINDOWS = require( '@stdlib/assert/is-windows' );
var cwd = require( '@stdlib/process/cwd' );
var ENV = require( '@stdlib/process/env' );


// MAIN //

/**
* Returns a default list of directory paths in which to search for modules referenced via non-relative paths.
*
* @private
* @returns {StringArray} list of paths
*/
function paths() {
	var out;
	var p;
	var i;

	out = [];

	// Extract the paths from the `NODE_PATH` environment variable...
	if ( ENV.NODE_PATH ) {
		if ( IS_WINDOWS ) {
			p = ENV.NODE_PATH.split( ';' );
		} else {
			p = ENV.NODE_PATH.split( ':' );
		}
		for ( i = 0; i < p.length; i++ ) {
			out.push( p[ i ] );
		}
	}
	// Append the current working directory to the list of paths:
	out.push( cwd() );

	return out;
}


// EXPORTS //

module.exports = paths;

/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var IS_WINDOWS = require( '@stdlib/assert/is-windows' );
var cwd = require( '@stdlib/process/cwd' );
var ENV = require( '@stdlib/process/env' );


// MAIN //

/**
* Returns a default list of directory paths in which to search for modules referenced via non-relative paths.
*
* @private
* @returns {StringArray} list of paths
*/
function paths() {
	var out;
	var p;
	var i;

	out = [];

	// Extract paths from the `NODE_PATH` environment variable...
	if ( ENV.NODE_PATH ) {
		if ( IS_WINDOWS ) {
			p = ENV.NODE_PATH.split( ';' );
		} else {
			p = ENV.NODE_PATH.split( ':' );
		}
		for ( i = 0; i < p.length; i++ ) {
			out.push( p[ i ] );
		}
	}
	// Append the current working directory to the list of paths:
	out.push( cwd() );

	return out;
}


// EXPORTS //

module.exports = paths;

Update comment