Skip to content

Commit b2d7c84

Browse files
committed
Merge branch 'develop' of https://github.com/stdlib-js/stdlib into develop
2 parents 500f735 + cb83dea commit b2d7c84

File tree

57 files changed

+1813
-181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1813
-181
lines changed

lib/node_modules/@stdlib/_tools/pkgs/addons/test/test.cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ tape( 'the command-line interface supports searching based on a pattern', opts,
148148
process.execPath,
149149
fpath,
150150
resolve( __dirname, '..', '..', '..', '..', '..' ), // WARNING: fragile, as assumes a particular directory structure
151-
'--pattern \'**/math/base/blas/dasum/package.json\''
151+
'--pattern \'**/blas/base/dasum/package.json\''
152152
];
153153

154154
exec( cmd.join( ' ' ), done );

lib/node_modules/@stdlib/_tools/pkgs/names/test/test.cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ tape( 'the command-line interface supports searching based on a pattern', opts,
148148
process.execPath,
149149
fpath,
150150
resolve( __dirname, '..', '..', '..', '..', '..' ), // WARNING: fragile, as assumes a particular directory structure
151-
'--pattern \'**/math/base/blas/dasum/package.json\''
151+
'--pattern \'**/blas/base/dasum/package.json\''
152152
];
153153

154154
exec( cmd.join( ' ' ), done );

lib/node_modules/@stdlib/assert/is-absolute-path/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ bool = isAbsolutePath.win32( '' );
142142
### Usage
143143

144144
```text
145-
Usage: is-absolute-path [options] <path>
145+
Usage: is-absolute-path [options] [<path>]
146146
147147
Options:
148148
@@ -164,6 +164,13 @@ $ is-absolute-path /foo/bar/baz --platform=posix
164164
true
165165
```
166166

167+
To use as a [standard stream][standard-streams],
168+
169+
```bash
170+
$ echo -n './docs/repl.txt' | is-absolute-path
171+
false
172+
```
173+
167174
</section>
168175

169176
<!-- /.examples -->
@@ -174,6 +181,8 @@ true
174181

175182
<section class="links">
176183

184+
[standard-streams]: https://en.wikipedia.org/wiki/Standard_streams
185+
177186
</section>
178187

179188
<!-- /.links -->

lib/node_modules/@stdlib/assert/is-absolute-path/docs/usage.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
Usage: is-absolute-path [options] <path>
2+
Usage: is-absolute-path [options] [<path>]
33

44
Options:
55

lib/node_modules/@stdlib/assert/is-alphagram/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ out = isAlphagram( 123 );
7575
### Usage
7676

7777
```text
78-
Usage: is-alphagram [options] <string>
78+
Usage: is-alphagram [options] [<string>]
7979
8080
Options:
8181
@@ -96,6 +96,13 @@ $ is-alphagram beep
9696
true
9797
```
9898

99+
To use as a [standard stream][standard-streams],
100+
101+
```bash
102+
$ echo -n 'hello' | is-alphagram
103+
false
104+
```
105+
99106
</section>
100107

101108
<!-- /.examples -->
@@ -108,6 +115,8 @@ true
108115

109116
[alphagram]: https://en.wiktionary.org/wiki/alphagram
110117

118+
[standard-streams]: https://en.wikipedia.org/wiki/Standard_streams
119+
111120
</section>
112121

113122
<!-- /.links -->

lib/node_modules/@stdlib/assert/is-alphagram/docs/usage.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
Usage: is-alphagram [options] <string>
2+
Usage: is-alphagram [options] [<string>]
33

44
Options:
55

lib/node_modules/@stdlib/assert/is-ascii/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ out = isASCII( 123 );
6868
### Usage
6969

7070
```text
71-
Usage: is-ascii [options] <string>
71+
Usage: is-ascii [options] [<string>]
7272
7373
Options:
7474
@@ -89,6 +89,13 @@ $ is-ascii beep
8989
true
9090
```
9191

92+
To use as a [standard stream][standard-streams],
93+
94+
```bash
95+
$ echo -n 'beep' | is-ascii
96+
true
97+
```
98+
9299
</section>
93100

94101
<!-- /.examples -->
@@ -101,6 +108,8 @@ true
101108

102109
[ascii]: https://en.wikipedia.org/wiki/ASCII
103110

111+
[standard-streams]: https://en.wikipedia.org/wiki/Standard_streams
112+
104113
</section>
105114

106115
<!-- /.links -->

lib/node_modules/@stdlib/assert/is-ascii/docs/usage.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
Usage: is-ascii [options] <string>
2+
Usage: is-ascii [options] [<string>]
33

44
Options:
55

lib/node_modules/@stdlib/assert/is-binary-string/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,57 @@ bool = isBinaryString( null );
5959

6060
<!-- /.examples -->
6161

62+
* * *
63+
64+
<section class="cli">
65+
66+
## CLI
67+
68+
<section class="usage">
69+
70+
### Usage
71+
72+
```text
73+
Usage: is-binary-string [options] [<string>]
74+
75+
Options:
76+
77+
-h, --help Print this message.
78+
-V, --version Print the package version.
79+
```
80+
81+
</section>
82+
83+
<!-- /.usage -->
84+
85+
<section class="examples">
86+
87+
### Examples
88+
89+
```bash
90+
$ is-binary-string 01234
91+
false
92+
```
93+
94+
To use as a [standard stream][standard-streams],
95+
96+
```bash
97+
$ echo -n '0110' | is-binary-string
98+
true
99+
```
100+
101+
</section>
102+
103+
<!-- /.examples -->
104+
105+
</section>
106+
107+
<!-- /.cli -->
108+
62109
<section class="links">
63110

111+
[standard-streams]: https://en.wikipedia.org/wiki/Standard_streams
112+
64113
</section>
65114

66115
<!-- /.links -->
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env node
2+
'use strict';
3+
4+
// MODULES //
5+
6+
var join = require( 'path' ).join;
7+
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
8+
var CLI = require( '@stdlib/tools/cli' );
9+
var stdin = require( '@stdlib/utils/read-stdin' );
10+
var RE_EOL = require( '@stdlib/regexp/eol' );
11+
var isBinaryString = require( './../lib' );
12+
13+
14+
// FUNCTIONS //
15+
16+
/**
17+
* Callback invoked upon reading from `stdin`.
18+
*
19+
* @private
20+
* @param {(Error|null)} error - error object
21+
* @param {Buffer} data - data
22+
* @returns {void}
23+
*/
24+
function onRead( error, data ) {
25+
/* eslint-disable no-console */
26+
var lines;
27+
var i;
28+
if ( error ) {
29+
process.exitCode = 1;
30+
return console.error( 'Error: %s', error.message );
31+
}
32+
lines = data.toString().split( RE_EOL );
33+
for ( i = 0; i < lines.length; i++ ) {
34+
console.log( isBinaryString( lines[ i ] ) );
35+
}
36+
} // end FUNCTION onRead()
37+
38+
39+
// MAIN //
40+
41+
/**
42+
* Main execution sequence.
43+
*
44+
* @private
45+
* @returns {void}
46+
*/
47+
function main() {
48+
var args;
49+
var cli;
50+
51+
// Create a command-line interface:
52+
cli = new CLI({
53+
'pkg': require( './../package.json' ),
54+
'options': require( './../etc/cli_opts.json' ),
55+
'help': readFileSync( join( __dirname, '..', 'docs', 'usage.txt' ), {
56+
'encoding': 'utf8'
57+
})
58+
});
59+
60+
// Get any provided command-line arguments:
61+
args = cli.args();
62+
63+
// Check if we are receiving data from `stdin`...
64+
if ( !process.stdin.isTTY ) {
65+
return stdin( onRead );
66+
}
67+
console.log( isBinaryString( String( args[ 0 ] ) ) ); // eslint-disable-line no-console
68+
} // end FUNCTION main()
69+
70+
main();
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
Usage: is-binary-string [options] [<string>]
3+
4+
Options:
5+
6+
-h, --help Print this message.
7+
-V, --version Print the package version.
8+

lib/node_modules/@stdlib/assert/is-binary-string/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@
1313
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
1414
}
1515
],
16+
"bin": {
17+
"is-binary-string": "./bin/cli"
18+
},
1619
"main": "./lib",
1720
"directories": {
1821
"benchmark": "./benchmark",
22+
"bin": "./bin",
1923
"doc": "./docs",
2024
"example": "./examples",
2125
"lib": "./lib",
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
var resolve = require( 'path' ).resolve;
2+
var proxyquire = require( 'proxyquire' );
3+
4+
var fpath = resolve( __dirname, '..', 'bin', 'cli' );
5+
6+
process.stdin.isTTY = false;
7+
8+
proxyquire( fpath, {
9+
'@stdlib/utils/read-stdin': stdin
10+
});
11+
12+
function stdin( clbk ) {
13+
clbk( new Error( 'beep' ) );
14+
}

0 commit comments

Comments
 (0)