From a4b06a4c772ab72c5d793d6d6e58ee5633eb059b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 5 Oct 2023 03:05:48 +0000 Subject: [PATCH] Auto-generated commit --- README.md | 4 +- package.json | 10 +-- test/dist/test.js | 212 +--------------------------------------------- 3 files changed, 11 insertions(+), 215 deletions(-) diff --git a/README.md b/README.md index dd6c8cf..bd74e8d 100644 --- a/README.md +++ b/README.md @@ -328,8 +328,8 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. [npm-image]: http://img.shields.io/npm/v/@stdlib/utils-type-of.svg [npm-url]: https://npmjs.org/package/@stdlib/utils-type-of -[test-image]: https://github.com/stdlib-js/utils-type-of/actions/workflows/test.yml/badge.svg?branch=v0.1.1 -[test-url]: https://github.com/stdlib-js/utils-type-of/actions/workflows/test.yml?query=branch:v0.1.1 +[test-image]: https://github.com/stdlib-js/utils-type-of/actions/workflows/test.yml/badge.svg?branch=main +[test-url]: https://github.com/stdlib-js/utils-type-of/actions/workflows/test.yml?query=branch:main [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/utils-type-of/main.svg [coverage-url]: https://codecov.io/github/stdlib-js/utils-type-of?branch=main diff --git a/package.json b/package.json index 215f567..c189f42 100644 --- a/package.json +++ b/package.json @@ -53,14 +53,14 @@ "@stdlib/array-uint8c": "^0.1.0", "@stdlib/assert-has-map-support": "^0.1.0", "@stdlib/assert-has-set-support": "^0.1.1", - "@stdlib/assert-has-symbol-support": "^0.1.0", + "@stdlib/assert-has-symbol-support": "^0.1.1", "@stdlib/assert-has-weakmap-support": "^0.1.1", "@stdlib/assert-has-weakset-support": "^0.1.1", - "@stdlib/assert-is-string": "^0.1.0", + "@stdlib/assert-is-string": "^0.1.1", "@stdlib/bench": "^0.1.0", - "@stdlib/boolean-ctor": "^0.1.0", - "@stdlib/buffer-from-string": "^0.1.0", - "@stdlib/number-ctor": "^0.1.0", + "@stdlib/boolean-ctor": "^0.1.1", + "@stdlib/buffer-from-string": "^0.1.1", + "@stdlib/number-ctor": "^0.1.1", "@stdlib/symbol-ctor": "^0.1.1", "@stdlib/utils-noop": "^0.1.1", "proxyquire": "^2.0.0", diff --git a/test/dist/test.js b/test/dist/test.js index 5fe1502..a8a9c60 100644 --- a/test/dist/test.js +++ b/test/dist/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2023 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. @@ -16,222 +16,18 @@ * limitations under the License. */ -/* eslint-disable no-new-wrappers */ - 'use strict'; // MODULES // var tape = require( 'tape' ); -var proxyquire = require( 'proxyquire' ); -var hasMapSupport = require( '@stdlib/assert-has-map-support' ); -var hasWeakMapSupport = require( '@stdlib/assert-has-weakmap-support' ); -var hasSetSupport = require( '@stdlib/assert-has-set-support' ); -var hasWeakSetSupport = require( '@stdlib/assert-has-weakset-support' ); -var hasSymbolSupport = require( '@stdlib/assert-has-symbol-support' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var string2buffer = require( '@stdlib/buffer-from-string' ); -var Number = require( '@stdlib/number-ctor' ); -var Symbol = require( '@stdlib/symbol-ctor' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var polyfill = require( './../../dist/polyfill.js' ); -var getType = require( './../../dist/main.js' ); -var typeOf = require( './../../dist' ); +var main = require( './../../dist' ); // TESTS // -tape( 'main export is a function', function test( t ) { +tape( 'main export is defined', function test( t ) { t.ok( true, __filename ); - t.strictEqual( typeof typeOf, 'function', 'export is a function' ); - t.end(); -}); - -tape( 'if an environment has non-standard `typeof` behavior, the main export is a polyfill', function test( t ) { - var typeOf = proxyquire( './../dist', { - './check.js': check - }); - - t.equal( typeOf.toString(), polyfill.toString(), 'exports polyfill' ); - t.end(); - - function check() { - return true; - } -}); - -tape( 'if an environment has standard `typeof` behavior, the main export is a function which extends built-in `typeof` behavior', function test( t ) { - var typeOf = proxyquire( './../dist', { - './check.js': check - }); - - t.equal( typeOf.toString(), getType.toString(), 'exports main implementation' ); - t.end(); - - function check() { - return false; - } -}); - -tape( 'the function returns a value\'s type', function test( t ) { - var expected; - var values; - var type; - var i; - - values = [ - 'a', - new String( 'a' ), - 5, - new Number( 5 ), - NaN, - true, - new Boolean( true ), - false, - new Boolean( false ), - void 0, - null, - [], - {}, - function noop() {}, - /./, - new Date(), - Math, - JSON, - new Error(), - new TypeError(), - new SyntaxError(), - new URIError(), - new EvalError(), - new ReferenceError(), - new RangeError(), - new Int8Array( 10 ), - new Uint8Array( 10 ), - new Uint8ClampedArray( 10 ), - new Int16Array( 10 ), - new Uint16Array( 10 ), - new Int32Array( 10 ), - new Uint32Array( 10 ), - new Float32Array( 10 ), - new Float64Array( 10 ), - new ArrayBuffer( 10 ), - string2buffer( 'beep' ) - ]; - - expected = [ - 'string', - 'string', - 'number', - 'number', - 'number', - 'boolean', - 'boolean', - 'boolean', - 'boolean', - 'undefined', - 'null', - 'array', - 'object', - 'function', - 'regexp', - 'date', - 'math', - 'json', - 'error', - 'typeerror', - 'syntaxerror', - 'urierror', - 'evalerror', - 'referenceerror', - 'rangeerror', - 'int8array', - 'uint8array', - 'uint8clampedarray', - 'int16array', - 'uint16array', - 'int32array', - 'uint32array', - 'float32array', - 'float64array', - 'arraybuffer', - 'buffer' - ]; - - for ( i = 0; i < values.length; i++ ) { - type = typeOf( values[i] ); - t.equal( type, expected[i], 'returns '+expected[i]+' when provided '+values[i] ); - } - t.end(); -}); - -tape( 'the function supports Map objects (ES2015)', function test( t ) { - var v; - if ( hasMapSupport() ) { - v = typeOf( new Map() ); - t.equal( v, 'map', 'returns map' ); - } + t.strictEqual( main !== void 0, true, 'main export is defined' ); t.end(); }); - -tape( 'the function supports WeakMap objects (ES2015)', function test( t ) { - var v; - if ( hasWeakMapSupport() ) { - v = typeOf( new WeakMap() ); - t.equal( v, 'weakmap', 'returns weakmap' ); - } - t.end(); -}); - -tape( 'the function supports Set objects (ES2015)', function test( t ) { - var v; - if ( hasSetSupport() ) { - v = typeOf( new Set() ); - t.equal( v, 'set', 'returns set' ); - } - t.end(); -}); - -tape( 'the function supports WeakSet objects (ES2015)', function test( t ) { - var v; - if ( hasWeakSetSupport() ) { - v = typeOf( new WeakSet() ); - t.equal( v, 'weakset', 'returns weakset' ); - } - t.end(); -}); - -tape( 'the function supports Symbol objects (ES2015)', function test( t ) { - var v; - if ( hasSymbolSupport() ) { - v = typeOf( Symbol( 'beep' ) ); - t.equal( v, 'symbol', 'returns symbol' ); - } - t.end(); -}); - -tape( 'the function supports custom objects', function test( t ) { - var v; - function Person() {} - v = typeOf( new Person() ); - t.equal( v, 'person', 'returns person' ); - t.end(); -}); - -tape( 'if a value\'s constructor is an anonymous function, the function returns an empty string', function test( t ) { - // eslint-disable-next-line func-names, no-extra-parens, space-before-function-paren - var v = typeOf( new ( function() {} )() ); - t.equal( v, '', 'returns empty string' ); - - t.end(); -}); - -// TODO: add generator function test