diff --git a/lib/node_modules/@stdlib/math/base/assert/is-finitef/include.gypi b/lib/node_modules/@stdlib/math/base/assert/is-finitef/include.gypi index 868c5c12e852..26476a8c2655 100644 --- a/lib/node_modules/@stdlib/math/base/assert/is-finitef/include.gypi +++ b/lib/node_modules/@stdlib/math/base/assert/is-finitef/include.gypi @@ -36,7 +36,7 @@ # Source files: 'src_files': [ - '<(src_dir)/addon.cpp', + '<(src_dir)/addon.c', ' +#include + +/** +* Receives JavaScript callback invocation data. +* +* @param env environment under which the function is invoked +* @param info callback data +* @return Node-API value +*/ +static napi_value addon( napi_env env, napi_callback_info info ) { + STDLIB_NAPI_ARGV( env, info, argv, argc, 1 ); + STDLIB_NAPI_ARGV_FLOAT( env, x, argv, 0 ); + STDLIB_NAPI_CREATE_INT32( env, (int32_t)stdlib_base_is_finitef( x ), out ); + return out; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) + diff --git a/lib/node_modules/@stdlib/math/base/assert/is-finitef/src/addon.cpp b/lib/node_modules/@stdlib/math/base/assert/is-finitef/src/addon.cpp deleted file mode 100644 index b63d5f0ecb21..000000000000 --- a/lib/node_modules/@stdlib/math/base/assert/is-finitef/src/addon.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 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. -*/ - -#include "stdlib/math/base/assert/is_finitef.h" -#include -#include -#include - -/** -* Add-on namespace. -*/ -namespace stdlib_math_base_assert_is_finitef { - - /** - * Tests if a single-precision floating-point numeric value is finite. - * - * ## Notes - * - * - When called from JavaScript, the function expects one argument: - * - * - `x`: a number - */ - napi_value node_is_finitef( napi_env env, napi_callback_info info ) { - napi_status status; - - size_t argc = 1; - napi_value argv[ 1 ]; - status = napi_get_cb_info( env, info, &argc, argv, nullptr, nullptr ); - assert( status == napi_ok ); - - if ( argc < 1 ) { - napi_throw_error( env, nullptr, "invalid invocation. Must provide a number." ); - return nullptr; - } - - napi_valuetype vtype0; - status = napi_typeof( env, argv[ 0 ], &vtype0 ); - assert( status == napi_ok ); - - napi_value v; - double x; - if ( vtype0 == napi_number ) { - status = napi_get_value_double( env, argv[ 0 ], &x ); - assert( status == napi_ok ); - - status = napi_create_int32( env, (int32_t)stdlib_base_is_finitef( (float)x ), &v ); - assert( status == napi_ok ); - } else { - status = napi_create_int32( env, 0, &v ); - assert( status == napi_ok ); - } - - return v; - } - - napi_value Init( napi_env env, napi_value exports ) { - napi_status status; - napi_value fcn; - status = napi_create_function( env, "exports", NAPI_AUTO_LENGTH, node_is_finitef, NULL, &fcn ); - assert( status == napi_ok ); - return fcn; - } - - NAPI_MODULE( NODE_GYP_MODULE_NAME, Init ) -} // end namespace stdlib_math_base_assert_is_finitef diff --git a/lib/node_modules/@stdlib/math/base/assert/is-finitef/test/test.native.js b/lib/node_modules/@stdlib/math/base/assert/is-finitef/test/test.native.js index 5f57644d5253..691c1973b714 100644 --- a/lib/node_modules/@stdlib/math/base/assert/is-finitef/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/assert/is-finitef/test/test.native.js @@ -74,24 +74,3 @@ tape( 'the function returns `false` if provided `-infinity`', opts, function tes t.equal( isfinitef( NINF ), false, 'returns false' ); t.end(); }); - -tape( 'the function returns `false` if not provided a finite number', opts, function test( t ) { - var values; - var i; - - values = [ - '5', - NaN, - true, - null, - void 0, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.equal( isfinitef( values[i] ), false, 'returns false' ); - } - t.end(); -});