diff --git a/lib/node_modules/@stdlib/utils/inherit/benchmark/benchmark.js b/lib/node_modules/@stdlib/utils/inherit/benchmark/benchmark.js new file mode 100644 index 000000000000..be532084341b --- /dev/null +++ b/lib/node_modules/@stdlib/utils/inherit/benchmark/benchmark.js @@ -0,0 +1,61 @@ +/** +* @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 bench = require( '@stdlib/bench' ); +var isFunction = require( '@stdlib/assert/is-function' ); +var pkg = require( './../package.json' ).name; +var inherit = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + function Foo() { + return this; + } + + Foo.prototype.beep = function beep() { + return 'boop'; + }; + + function Bar() { + Foo.call( this ); + return this; + } + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = inherit( Bar, Foo ); + if ( typeof out !== 'function' ) { + b.fail( 'should return a function' ); + } + } + b.toc(); + if ( !isFunction( out ) ) { + b.fail( 'should return a function' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/utils/inherit/package.json b/lib/node_modules/@stdlib/utils/inherit/package.json index 3f0b4daec9d6..0c273664ed63 100644 --- a/lib/node_modules/@stdlib/utils/inherit/package.json +++ b/lib/node_modules/@stdlib/utils/inherit/package.json @@ -15,6 +15,7 @@ ], "main": "./lib", "directories": { + "benchmark": "./benchmark", "doc": "./docs", "example": "./examples", "lib": "./lib",