From 2814e395383420256abcaa3e73e3c731df225dfe Mon Sep 17 00:00:00 2001 From: Mahi Date: Sat, 31 Jan 2026 00:06:20 +0530 Subject: [PATCH] tools/snippets: add documentation and basic tests for placeholder snippet function --- tools/snippets/lib/index.js | 32 +++++++------------------------- tools/snippets/lib/main.js | 37 +++++++++++-------------------------- tools/snippets/test/test.js | 28 ++++++---------------------- 3 files changed, 24 insertions(+), 73 deletions(-) diff --git a/tools/snippets/lib/index.js b/tools/snippets/lib/index.js index 5ec20be28792..83fc0b376ff7 100644 --- a/tools/snippets/lib/index.js +++ b/tools/snippets/lib/index.js @@ -1,40 +1,22 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 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'; /** -* TODO: description +* Example snippet utility. * -* @module @stdlib/ +* @module @stdlib/tools/snippets * * @example -* var TODO = require( '@stdlib/' ); +* var snippet = require( '@stdlib/tools/snippets' ); * -* var v = TODO( 0.0 ); -* // returns TODO +* var v = snippet( 3.0 ); +* // returns 3.0 */ // MODULES // -var TODO = require( './main.js' ); +var snippet = require( './main.js' ); // EXPORTS // -module.exports = TODO; +module.exports = snippet; diff --git a/tools/snippets/lib/main.js b/tools/snippets/lib/main.js index c9409542e1e4..49d1ff3748aa 100644 --- a/tools/snippets/lib/main.js +++ b/tools/snippets/lib/main.js @@ -1,40 +1,25 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 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'; // MAIN // /** -* TODO: description +* Example snippet function which returns the input value unchanged. +* +* This function exists as a simple demonstration utility for tooling +* and documentation examples. * -* @param {} TODO - TODO: param desc -* @returns {} TODO: desc +* @param {number} x - input value +* @returns {number} input value * * @example -* var v = TODO( 0.0 ); -* // returns TODO +* var v = snippet( 2.0 ); +* // returns 2.0 */ -function TODO() { - // TODO: implementation +function snippet( x ) { + return x; } // EXPORTS // -module.exports = TODO; +module.exports = snippet; diff --git a/tools/snippets/test/test.js b/tools/snippets/test/test.js index 5fc8f28d2b0c..596c55d75288 100644 --- a/tools/snippets/test/test.js +++ b/tools/snippets/test/test.js @@ -1,35 +1,19 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 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 tape = require( 'tape' ); -var TODO = require( './../lib' ); +var snippet = require( './../lib' ); // TESTS // tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof TODO, 'function', 'main export is a function' ); + t.strictEqual( typeof snippet, 'function', 'exports a function' ); t.end(); }); -// TODO: add tests +tape( 'returns input value unchanged', function test( t ) { + t.strictEqual( snippet( 4.0 ), 4.0, 'returns same value' ); + t.end(); +});