Skip to content

Commit 5832be1

Browse files
committed
Add browser entry point
1 parent 6916d9d commit 5832be1

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use strict';
2+
3+
// MAIN //
4+
5+
/**
6+
* Returns the current working directory.
7+
*
8+
* ## Notes
9+
*
10+
* - This function assumes a virtual filesystem in a browser environment.
11+
*
12+
* @returns {string} current working directory
13+
*
14+
* @example
15+
* var dir = cwd();
16+
* // returns '/path/to/current/working/directory'
17+
*/
18+
function cwd() {
19+
// TODO: implement
20+
return '/';
21+
}
22+
23+
24+
// EXPORTS //
25+
26+
module.exports = cwd;

lib/node_modules/@stdlib/process/cwd/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"cwd": "./bin/cli"
1818
},
1919
"main": "./lib",
20+
"browser": "./lib/browser.js",
2021
"directories": {
2122
"benchmark": "./benchmark",
2223
"bin": "./bin",
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
// MODULES //
4+
5+
var tape = require( 'tape' );
6+
var cwd = require( './../lib/browser.js' );
7+
8+
9+
// TESTS //
10+
11+
tape( 'main export is a function', function test( t ) {
12+
t.ok( true, __filename );
13+
t.equal( typeof cwd, 'function', 'main export is a function' );
14+
t.end();
15+
});
16+
17+
tape( 'the function returns the current working directory', function test( t ) {
18+
// TODO: update if, and when, we actually have a browser implementation
19+
t.equal( cwd(), '/', 'returns current working directory' );
20+
t.end();
21+
});

0 commit comments

Comments
 (0)