Skip to content

Commit 2814e39

Browse files
committed
tools/snippets: add documentation and basic tests for placeholder snippet function
1 parent d660cab commit 2814e39

3 files changed

Lines changed: 24 additions & 73 deletions

File tree

tools/snippets/lib/index.js

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,22 @@
1-
/**
2-
* @license Apache-2.0
3-
*
4-
* Copyright (c) 2026 The Stdlib Authors.
5-
*
6-
* Licensed under the Apache License, Version 2.0 (the "License");
7-
* you may not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing, software
13-
* distributed under the License is distributed on an "AS IS" BASIS,
14-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
* See the License for the specific language governing permissions and
16-
* limitations under the License.
17-
*/
18-
191
'use strict';
202

213
/**
22-
* TODO: description
4+
* Example snippet utility.
235
*
24-
* @module @stdlib/<TODO: module path>
6+
* @module @stdlib/tools/snippets
257
*
268
* @example
27-
* var TODO = require( '@stdlib/<TODO: module path>' );
9+
* var snippet = require( '@stdlib/tools/snippets' );
2810
*
29-
* var v = TODO( 0.0 );
30-
* // returns TODO
11+
* var v = snippet( 3.0 );
12+
* // returns 3.0
3113
*/
3214

3315
// MODULES //
3416

35-
var TODO = require( './main.js' );
17+
var snippet = require( './main.js' );
3618

3719

3820
// EXPORTS //
3921

40-
module.exports = TODO;
22+
module.exports = snippet;

tools/snippets/lib/main.js

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,25 @@
1-
/**
2-
* @license Apache-2.0
3-
*
4-
* Copyright (c) 2026 The Stdlib Authors.
5-
*
6-
* Licensed under the Apache License, Version 2.0 (the "License");
7-
* you may not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing, software
13-
* distributed under the License is distributed on an "AS IS" BASIS,
14-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
* See the License for the specific language governing permissions and
16-
* limitations under the License.
17-
*/
18-
191
'use strict';
202

213
// MAIN //
224

235
/**
24-
* TODO: description
6+
* Example snippet function which returns the input value unchanged.
7+
*
8+
* This function exists as a simple demonstration utility for tooling
9+
* and documentation examples.
2510
*
26-
* @param {<TODO: type>} TODO - TODO: param desc
27-
* @returns {<TODO: type>} TODO: desc
11+
* @param {number} x - input value
12+
* @returns {number} input value
2813
*
2914
* @example
30-
* var v = TODO( 0.0 );
31-
* // returns TODO
15+
* var v = snippet( 2.0 );
16+
* // returns 2.0
3217
*/
33-
function TODO() {
34-
// TODO: implementation
18+
function snippet( x ) {
19+
return x;
3520
}
3621

3722

3823
// EXPORTS //
3924

40-
module.exports = TODO;
25+
module.exports = snippet;

tools/snippets/test/test.js

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,19 @@
1-
/**
2-
* @license Apache-2.0
3-
*
4-
* Copyright (c) 2026 The Stdlib Authors.
5-
*
6-
* Licensed under the Apache License, Version 2.0 (the "License");
7-
* you may not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing, software
13-
* distributed under the License is distributed on an "AS IS" BASIS,
14-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
* See the License for the specific language governing permissions and
16-
* limitations under the License.
17-
*/
18-
191
'use strict';
202

213
// MODULES //
224

235
var tape = require( 'tape' );
24-
var TODO = require( './../lib' );
6+
var snippet = require( './../lib' );
257

268

279
// TESTS //
2810

2911
tape( 'main export is a function', function test( t ) {
30-
t.ok( true, __filename );
31-
t.strictEqual( typeof TODO, 'function', 'main export is a function' );
12+
t.strictEqual( typeof snippet, 'function', 'exports a function' );
3213
t.end();
3314
});
3415

35-
// TODO: add tests
16+
tape( 'returns input value unchanged', function test( t ) {
17+
t.strictEqual( snippet( 4.0 ), 4.0, 'returns same value' );
18+
t.end();
19+
});

0 commit comments

Comments
 (0)