Changeset 0c6b92a for imaps-frontend/node_modules/which-builtin-type
- Timestamp:
- 12/12/24 17:06:06 (5 weeks ago)
- Branches:
- main
- Parents:
- d565449
- Location:
- imaps-frontend/node_modules/which-builtin-type
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/which-builtin-type/CHANGELOG.md
rd565449 r0c6b92a 5 5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) 6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 8 ## [v1.2.0](https://github.com/inspect-js/which-builtin-type/compare/v1.1.4...v1.2.0) - 2024-11-23 9 10 ### Commits 11 12 - [New] add types [`d4aa2db`](https://github.com/inspect-js/which-builtin-type/commit/d4aa2db289a8d97c6917c0edb1edcb32001488a8) 13 - [actions] split out node 10-20, and 20+ [`7b3d28b`](https://github.com/inspect-js/which-builtin-type/commit/7b3d28bcb1258cdfd5a7df5606622351596fb442) 14 - [Refactor] use `callBound` to cache Promise#then [`a000377`](https://github.com/inspect-js/which-builtin-type/commit/a0003772dabdd5fd4b84c2ed8e139df008a437e8) 15 - [Dev Deps] update `auto-changelog`, `object-inspect`, `tape` [`37062d2`](https://github.com/inspect-js/which-builtin-type/commit/37062d280a8c36c1bd96b6cfbe053f10cf8d71b6) 16 - [Tests] replace `aud` with `npm audit` [`337aac1`](https://github.com/inspect-js/which-builtin-type/commit/337aac1d88fc63d935bd15a97926e9b0b462a735) 17 - [Deps] update `is-finalizationregistry` [`4ef8763`](https://github.com/inspect-js/which-builtin-type/commit/4ef8763a19709df7ad50d790bd2b724f531a65d9) 18 - [Dev Deps] add missing peer dep [`1cb2842`](https://github.com/inspect-js/which-builtin-type/commit/1cb28421438eb4ee8f0f284b535f1cfc6b9c9757) 7 19 8 20 ## [v1.1.4](https://github.com/inspect-js/which-builtin-type/compare/v1.1.3...v1.1.4) - 2024-07-29 -
imaps-frontend/node_modules/which-builtin-type/index.js
rd565449 r0c6b92a 12 12 var isGeneratorFunction = require('is-generator-function'); 13 13 var isAsyncFunction = require('is-async-function'); 14 var callBound = require('call-bind/callBound'); 14 15 var hasToStringTag = require('has-tostringtag/shams')(); 15 16 var toStringTag = hasToStringTag && Symbol.toStringTag; … … 17 18 var $Object = Object; 18 19 19 var promiseThen = typeof Promise === 'function' && Promise.prototype.then; 20 /** @type {undefined | ((value: ThisParameterType<typeof Promise.prototype.then>, ...args: Parameters<typeof Promise.prototype.then>) => ReturnType<typeof Promise.prototype.then>)} */ 21 var promiseThen = callBound('Promise.prototype.then', true); 22 /** @type {<T = unknown>(value: unknown) => value is Promise<T>} */ 20 23 var isPromise = function isPromise(value) { 21 24 if (!value || typeof value !== 'object' || !promiseThen) { … … 23 26 } 24 27 try { 25 promiseThen .call(value, null, function () {});28 promiseThen(value, null, function () {}); 26 29 return true; 27 30 } catch (e) {} … … 29 32 }; 30 33 34 /** @type {(builtinName: unknown) => boolean} */ 31 35 var isKnownBuiltin = function isKnownBuiltin(builtinName) { 32 return builtinName36 return !!builtinName 33 37 // primitives 34 38 && builtinName !== 'BigInt' … … 74 78 }; 75 79 80 /** @type {import('.')} */ 76 81 module.exports = function whichBuiltinType(value) { 77 82 if (value == null) { … … 110 115 return 'Promise'; 111 116 } 117 // @ts-expect-error TS can't figure out that `value` is an `object` after the `which` check above 112 118 if (toStringTag && toStringTag in value) { 113 119 var tag = value[toStringTag]; … … 117 123 } 118 124 if (typeof value.constructor === 'function') { 119 var constructorName = name(value.constructor); 125 // eslint-disable-next-line no-extra-parens 126 var constructorName = name(/** @type {Parameters<name>[0]} */ (value.constructor)); 120 127 if (isKnownBuiltin(constructorName)) { 121 128 return constructorName; -
imaps-frontend/node_modules/which-builtin-type/package.json
rd565449 r0c6b92a 1 1 { 2 2 "name": "which-builtin-type", 3 "version": "1. 1.4",3 "version": "1.2.0", 4 4 "description": "What is the type of this builtin JS value?", 5 5 "main": "index.js", 6 "types": "index.d.ts", 6 7 "exports": { 7 8 ".": "./index.js", … … 15 16 "prelint": "evalmd README.md", 16 17 "lint": "eslint --ext=js,mjs .", 18 "postlint": "tsc -P . && attw -P", 17 19 "pretest": "npm run lint", 18 20 "tests-only": "nyc tape 'test/**/*.js'", 19 21 "test": "npm run tests-only", 20 "posttest": " aud--production",22 "posttest": "npx npm@'>=10.2' audit --production", 21 23 "version": "auto-changelog && git add CHANGELOG.md", 22 24 "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" … … 44 46 }, 45 47 "devDependencies": { 48 "@arethetypeswrong/cli": "^0.17.0", 46 49 "@ljharb/eslint-config": "^21.1.1", 47 "aud": "^2.0.4", 48 "auto-changelog": "^2.4.0", 50 "@ljharb/tsconfig": "^0.2.0", 51 "@types/call-bind": "^1.0.5", 52 "@types/for-each": "^0.3.3", 53 "@types/function.prototype.name": "^1.1.3", 54 "@types/has-symbols": "^1.0.2", 55 "@types/is-async-function": "^2.0.3", 56 "@types/is-date-object": "^1.0.4", 57 "@types/is-generator-function": "^1.0.3", 58 "@types/is-regex": "^1.0.2", 59 "@types/is-weakref": "^1.0.0", 60 "@types/make-arrow-function": "^1.2.2", 61 "@types/make-async-function": "^1.0.2", 62 "@types/object-inspect": "^1.13.0", 63 "@types/object.assign": "^4.1.0", 64 "@types/tape": "^5.6.4", 65 "@types/which-boxed-primitive": "^1.0.3", 66 "auto-changelog": "^2.5.0", 49 67 "available-typed-arrays": "^1.0.7", 68 "encoding": "^0.1.13", 50 69 "eslint": "=8.8.0", 51 70 "evalmd": "^0.0.19", … … 59 78 "npmignore": "^0.3.1", 60 79 "nyc": "^10.3.2", 61 "object-inspect": "^1.13. 2",80 "object-inspect": "^1.13.3", 62 81 "object.assign": "^4.1.5", 63 82 "safe-publish-latest": "^2.0.0", 64 "tape": "^5.8.1" 83 "tape": "^5.9.0", 84 "typescript": "next" 65 85 }, 66 86 "auto-changelog": { … … 73 93 }, 74 94 "dependencies": { 95 "call-bind": "^1.0.7", 75 96 "function.prototype.name": "^1.1.6", 76 97 "has-tostringtag": "^1.0.2", 77 98 "is-async-function": "^2.0.0", 78 99 "is-date-object": "^1.0.5", 79 "is-finalizationregistry": "^1. 0.2",100 "is-finalizationregistry": "^1.1.0", 80 101 "is-generator-function": "^1.0.10", 81 102 "is-regex": "^1.1.4", -
imaps-frontend/node_modules/which-builtin-type/test/index.js
rd565449 r0c6b92a 22 22 t.equal(which(null), null, 'null is null'); 23 23 t.equal(which(undefined), undefined, 'undefined is undefined'); 24 // @ts-expect-error 24 25 t.equal(which(), undefined, 'absent is undefined'); 25 26 … … 28 29 29 30 test('non-nullish', function (t) { 31 /** @constructor */ 30 32 var F = function Foo() {}; 31 33 … … 70 72 GeneratorFunction: generators, 71 73 AsyncFunction: asyncs, 72 Object: [ 74 // eslint-disable-next-line no-extra-parens 75 Object: /** @type {object[]} */ ([ 73 76 {}, 74 77 { constructor: null }, 75 78 Math 76 ] ,79 ]), 77 80 Symbol: hasSymbols ? [ 78 81 Symbol.iterator, … … 121 124 }; 122 125 forEach(availableTypedArrays(), function (TypedArray) { 126 // @ts-expect-error not sure how to infer this as being spreaded into the above object literal 123 127 tests[TypedArray] = [ 124 128 new global[TypedArray](0), … … 138 142 ) { 139 143 if (hasToStringTag) { 144 /** @type {{ [k in typeof Symbol.toStringTag]?: string }} */ 140 145 var fakerTag = {}; 141 146 fakerTag[Symbol.toStringTag] = expected; … … 147 152 } 148 153 149 var fakerConstructor = { constructor: global[expected] }; 154 /** @typedef {Exclude<typeof expected, 'GeneratorFunction' | 'AsyncFunction' | 'Foo'>} GlobalKey */ 155 156 var fakerConstructor = { 157 // eslint-disable-next-line no-extra-parens 158 constructor: global[/** @type {GlobalKey} */ (expected)] || tests[expected] 159 }; 150 160 t.equal( 151 161 which(fakerConstructor), … … 155 165 156 166 if (hasToStringTag) { 157 var fakerConstructorTag = { constructor: global[expected] }; 167 /** @type {{ constructor: Function } & { [k in typeof Symbol.toStringTag]?: string }} */ 168 var fakerConstructorTag = { 169 // eslint-disable-next-line no-extra-parens 170 constructor: global[/** @type {GlobalKey} */ (expected)] || tests[expected] 171 }; 158 172 fakerConstructorTag[Symbol.toStringTag] = expected; 159 173 t.equal(
Note:
See TracChangeset
for help on using the changeset viewer.