Skip to content

Commit 69df715

Browse files
committed
Add namespace
1 parent e194a0c commit 69df715

File tree

5 files changed

+150
-0
lines changed

5 files changed

+150
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Types
2+
3+
> Standard library types.
4+
5+
6+
<section class="usage">
7+
8+
## Usage
9+
10+
``` javascript
11+
var types = require( '@stdlib/types' );
12+
```
13+
14+
#### types
15+
16+
Standard library types.
17+
18+
``` javascript
19+
var o = types;
20+
// returns {...}
21+
```
22+
23+
</section>
24+
25+
<!-- /.usage -->
26+
27+
28+
<section class="examples">
29+
30+
## Examples
31+
32+
<!-- TODO: better examples -->
33+
34+
``` javascript
35+
var getKeys = require( 'object-keys' ).shim();
36+
var ns = require( '@stdlib/types' );
37+
38+
console.log( getKeys( ns ) );
39+
```
40+
41+
</section>
42+
43+
<!-- /.examples -->
44+
45+
46+
<section class="links">
47+
48+
</section>
49+
50+
<!-- /.links -->
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
'use strict';
2+
3+
var getKeys = require( 'object-keys' ).shim();
4+
var ns = require( './../lib' );
5+
6+
console.log( getKeys( ns ) );
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
'use strict';
2+
3+
/*
4+
* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.
5+
*/
6+
7+
// MODULES //
8+
9+
var setReadOnly = require( '@stdlib/utils/define-read-only-property' );
10+
11+
12+
// MAIN //
13+
14+
/**
15+
* Top-level namespace.
16+
*
17+
* @namespace ns
18+
*/
19+
var ns = {};
20+
21+
/**
22+
* @name Float64Array
23+
* @memberof ns
24+
* @readonly
25+
* @constructor
26+
* @see {@link module:@stdlib/types/Float64Array}
27+
*/
28+
setReadOnly( ns, 'Float64Array', require( '@stdlib/types/float64array' ) );
29+
30+
31+
// EXPORTS //
32+
33+
module.exports = ns;
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "@stdlib/types",
3+
"version": "0.0.0",
4+
"description": "Standard types.",
5+
"author": {
6+
"name": "The Stdlib Authors",
7+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
8+
},
9+
"contributors": [
10+
{
11+
"name": "The Stdlib Authors",
12+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
13+
}
14+
],
15+
"scripts": {},
16+
"main": "lib/index.js",
17+
"repository": {
18+
"type": "git",
19+
"url": "git://github.com/stdlib-js/stdlib.git"
20+
},
21+
"homepage": "https://github.com/stdlib-js/stdlib",
22+
"keywords": [
23+
"stdlib",
24+
"stdtypes",
25+
"types",
26+
"data",
27+
"structures"
28+
],
29+
"bugs": {
30+
"url": "https://github.com/stdlib-js/stdlib/issues"
31+
},
32+
"dependencies": {},
33+
"devDependencies": {},
34+
"engines": {
35+
"node": ">=0.10.0",
36+
"npm": ">2.7.0"
37+
},
38+
"license": "Apache-2.0"
39+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
3+
// MODULES //
4+
5+
var tape = require( 'tape' );
6+
var getKeys = require( 'object-keys' ).shim();
7+
var ns = require( './../lib' );
8+
9+
10+
// TESTS //
11+
12+
tape( 'main export is an object', function test( t ) {
13+
t.ok( true, __filename );
14+
t.equal( typeof ns, 'object', 'main export is an object' );
15+
t.end();
16+
});
17+
18+
tape( 'the exported object contains key-value pairs', function test( t ) {
19+
var keys = getKeys( ns );
20+
t.equal( keys.length > 0, true, 'has keys' );
21+
t.end();
22+
});

0 commit comments

Comments
 (0)