Ignore:
Timestamp:
12/12/24 17:06:06 (5 weeks ago)
Author:
stefan toskovski <stefantoska84@…>
Branches:
main
Parents:
d565449
Message:

Pred finalna verzija

Location:
imaps-frontend/node_modules/es-to-primitive
Files:
7 added
2 deleted
12 edited
1 moved

Legend:

Unmodified
Added
Removed
  • imaps-frontend/node_modules/es-to-primitive/.eslintrc

    rd565449 r0c6b92a  
    55
    66        "rules": {
    7                 "complexity": [2, 14],
    87                "func-name-matching": 0,
    98                "id-length": [2, { "min": 1, "max": 24, "properties": "never" }],
    10                 "max-statements": [2, 20],
    119                "new-cap": [2, { "capIsNewExceptions": ["GetMethod"] }]
    1210        },
     
    1614                        "files": "test/**",
    1715                        "rules": {
    18                                 "max-lines-per-function": [2, { "max": 68 }],
     16                                "max-lines-per-function": 0,
    1917                        },
    2018                }
  • imaps-frontend/node_modules/es-to-primitive/CHANGELOG.md

    rd565449 r0c6b92a  
     1# Changelog
     2
     3All notable changes to this project will be documented in this file.
     4
     5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
     6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
     7
     8## [v1.3.0](https://github.com/ljharb/es-to-primitive/compare/v1.2.1...v1.3.0) - 2024-11-26
     9
     10### Commits
     11
     12- [actions] reuse common workflows [`bb72efc`](https://github.com/ljharb/es-to-primitive/commit/bb72efc7e04ae11b84e4aecf120a4e9063e34428)
     13- [Tests] use `es-value-fixtures` [`a912f7b`](https://github.com/ljharb/es-to-primitive/commit/a912f7b675333735c1c980cda88772ac1870395b)
     14- [Tests] migrate tests to Github Actions [`510baf0`](https://github.com/ljharb/es-to-primitive/commit/510baf092633a62d59866fbf56836ce42c717c70)
     15- [New] add types [`69ba1fd`](https://github.com/ljharb/es-to-primitive/commit/69ba1fdcac834b03698739990ba98fe6007024dc)
     16- [meta] remove unused Makefile [`4ea66e6`](https://github.com/ljharb/es-to-primitive/commit/4ea66e62ef4afa0102eb8335ba3e003e8332f664)
     17- [actions] use `node/install` instead of `node/run`; use `codecov` action [`3c31937`](https://github.com/ljharb/es-to-primitive/commit/3c31937119ca24fd6d00e362d6435a28cfe9e91c)
     18- [meta] do not publish github action workflow files [`389567e`](https://github.com/ljharb/es-to-primitive/commit/389567e8523b65b90b529f1029d215fd4f12ac14)
     19- [meta] use `npmignore` to autogenerate an npmignore file [`9f3aa76`](https://github.com/ljharb/es-to-primitive/commit/9f3aa7651791ab9386408035491a1ba4fec4c432)
     20- [actions] split out node 10-20, and 20+ [`c60d7d8`](https://github.com/ljharb/es-to-primitive/commit/c60d7d822a36880bce0535335c70fdc2a8da232d)
     21- [Tests] run `nyc` on all tests; use `tape` runner [`29cbb89`](https://github.com/ljharb/es-to-primitive/commit/29cbb89800b5cfef9bef3ae7e0e779c782e1bbb9)
     22- [meta] add `auto-changelog` [`ea744b2`](https://github.com/ljharb/es-to-primitive/commit/ea744b2a0bda788b0d957c1787e41434e98b0155)
     23- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `function.prototype.name`, `has-symbols`, `object-inspect`, `object-is`, `tape` [`e5c3c79`](https://github.com/ljharb/es-to-primitive/commit/e5c3c792f67685a9647e817e7582d4c76a876f69)
     24- [actions] add automatic rebasing / merge commit blocking [`a5a6f00`](https://github.com/ljharb/es-to-primitive/commit/a5a6f0066540c91c8aa45a4921f1cd2349f435ba)
     25- [Dev Deps] update `@ljharb/eslint-config`, `es-value-fixtures`, `function.prototype.name`, `npmignore`, `object-inspect`, `object-is`, `tape` [`7941fd5`](https://github.com/ljharb/es-to-primitive/commit/7941fd530fb3a73f923b76c739335ffc21793ad6)
     26- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `es-value-fixtures`, `foreach`, `object-inspect`, `tape` [`eb1c79c`](https://github.com/ljharb/es-to-primitive/commit/eb1c79c288c89154014634b94f64308344901eaf)
     27- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `function.prototype.name`, `object-inspect`, `safe-publish-latest`, `tape` [`249b42f`](https://github.com/ljharb/es-to-primitive/commit/249b42f1ce069ea78a032f10414d1c1c0b6c6345)
     28- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `function.prototype.name`, `object-inspect`, `object-is`, `tape` [`d57d5e9`](https://github.com/ljharb/es-to-primitive/commit/d57d5e9ea5ea4778f383e2f1aa637be0be80dd78)
     29- [actions] update codecov uploader [`003b62c`](https://github.com/ljharb/es-to-primitive/commit/003b62c483372d5eac38f51925b6cbdf5d7a0665)
     30- [actions] add "Allow Edits" workflow [`75ee990`](https://github.com/ljharb/es-to-primitive/commit/75ee99083626dc14558ae294c127e4aaf925d214)
     31- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `object-is`; add `safe-publish-latest` [`ba5da7b`](https://github.com/ljharb/es-to-primitive/commit/ba5da7bffd93c3cc2e079ad751a3e678333a973e)
     32- [readme] remove travis badge [`6f7aec7`](https://github.com/ljharb/es-to-primitive/commit/6f7aec78e4f1ebfca74c384a837063f4099e7b9b)
     33- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`3291fd5`](https://github.com/ljharb/es-to-primitive/commit/3291fd567695b45bddc58e5ec3da2dcce0e5ccc7)
     34- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `function.prototype.name`, `has-symbols`, `object-inspect` [`53007f2`](https://github.com/ljharb/es-to-primitive/commit/53007f25d1f26e301b4f41d070c423723bed1690)
     35- [actions] update checkout action [`69640db`](https://github.com/ljharb/es-to-primitive/commit/69640dbb9ddafe05527388fe72bda1aca08d07b5)
     36- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-is`, `tape`; add `aud` [`c9d644e`](https://github.com/ljharb/es-to-primitive/commit/c9d644ef3c6b2210e86ce2d3aa8e8b1668f6801d)
     37- [Tests] use `for-each` instead of `foreach` [`e9117bb`](https://github.com/ljharb/es-to-primitive/commit/e9117bb055417cb721dbf5dbe1d23b058a8241f2)
     38- [readme] add github actions/codecov badges [`53cd375`](https://github.com/ljharb/es-to-primitive/commit/53cd375ab22a25d4bada35000473e30c22ee2028)
     39- [Deps] update `is-callable`, `is-date-object`, `is-symbol` [`8116c68`](https://github.com/ljharb/es-to-primitive/commit/8116c68a8ba555f8daaf1d71a60c974d3439c94b)
     40- [Tests] fix test skipping for `Symbol.toPrimitive` [`e6268ef`](https://github.com/ljharb/es-to-primitive/commit/e6268ef31b34cb5263501ba9735ccce78a07e504)
     41- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`da41c40`](https://github.com/ljharb/es-to-primitive/commit/da41c40399c2a574f74a59b85800d9934b91d49a)
     42- [Deps] update `is-callable`, `is-date-object` [`96fe13f`](https://github.com/ljharb/es-to-primitive/commit/96fe13ff3c486c7857c2ca69ac70161ef0e5b4a1)
     43- [Tests] replace `aud` with `npm audit` [`0b53154`](https://github.com/ljharb/es-to-primitive/commit/0b531546081427cb8a4fc06fde5540ba0b287b5b)
     44- [meta] use `prepublishOnly` script for npm 7+ [`9d7d485`](https://github.com/ljharb/es-to-primitive/commit/9d7d4856d4b5f28c68de2aba068522b9a85ee669)
     45- [Deps] update `is-callable` [`3c990b6`](https://github.com/ljharb/es-to-primitive/commit/3c990b646813e2470b19460e32801113f9acc13b)
     46- [Deps] update `is-callable` [`9bcfff2`](https://github.com/ljharb/es-to-primitive/commit/9bcfff276ce078034404b6b27e4f74beb530002c)
     47- [Deps] update `is-callable` [`1eb5478`](https://github.com/ljharb/es-to-primitive/commit/1eb5478e0c93b230b7bc67f9fef963d94a391117)
     48- [meta] only run `aud` on prod deps [`1fcd896`](https://github.com/ljharb/es-to-primitive/commit/1fcd89684a4351c15fec2cb289ecc331f917b80e)
     49- [Deps] update `is-symbol` [`7174a47`](https://github.com/ljharb/es-to-primitive/commit/7174a474f4f9f07319c81f046b10446caf9b3af0)
     50
     51<!-- auto-changelog-above -->
     52
    1531.2.1 / 2019-11-08
    254=================
  • imaps-frontend/node_modules/es-to-primitive/README.md

    rd565449 r0c6b92a  
    11# es-to-primitive <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
    22
    3 [![Build Status][travis-svg]][travis-url]
     3[![github actions][actions-image]][actions-url]
     4[![coverage][codecov-image]][codecov-url]
    45[![dependency status][deps-svg]][deps-url]
    56[![dev dependency status][dev-deps-svg]][dev-deps-url]
     
    3637
    3738[package-url]: https://npmjs.org/package/es-to-primitive
    38 [npm-version-svg]: http://versionbadg.es/ljharb/es-to-primitive.svg
    39 [travis-svg]: https://travis-ci.org/ljharb/es-to-primitive.svg
    40 [travis-url]: https://travis-ci.org/ljharb/es-to-primitive
     39[npm-version-svg]: https://versionbadg.es/ljharb/es-to-primitive.svg
    4140[deps-svg]: https://david-dm.org/ljharb/es-to-primitive.svg
    4241[deps-url]: https://david-dm.org/ljharb/es-to-primitive
     
    4443[dev-deps-url]: https://david-dm.org/ljharb/es-to-primitive#info=devDependencies
    4544[npm-badge-png]: https://nodei.co/npm/es-to-primitive.png?downloads=true&stars=true
    46 [license-image]: http://img.shields.io/npm/l/es-to-primitive.svg
     45[license-image]: https://img.shields.io/npm/l/es-to-primitive.svg
    4746[license-url]: LICENSE
    48 [downloads-image]: http://img.shields.io/npm/dm/es-to-primitive.svg
    49 [downloads-url]: http://npm-stat.com/charts.html?package=es-to-primitive
     47[downloads-image]: https://img.shields.io/npm/dm/es-to-primitive.svg
     48[downloads-url]: https://npm-stat.com/charts.html?package=es-to-primitive
     49[codecov-image]: https://codecov.io/gh/ljharb/es-to-primitive/branch/main/graphs/badge.svg
     50[codecov-url]: https://app.codecov.io/gh/ljharb/es-to-primitive/
     51[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-to-primitive
     52[actions-url]: https://github.com/ljharb/es-to-primitive/actions
  • imaps-frontend/node_modules/es-to-primitive/es2015.js

    rd565449 r0c6b92a  
    88var isSymbol = require('is-symbol');
    99
     10/** @type {(O: { valueOf?: () => unknown, toString?: () => unknown }, hint: 'number' | 'string' | 'default') => null | undefined | string | symbol | number | boolean | bigint} */
    1011var ordinaryToPrimitive = function OrdinaryToPrimitive(O, hint) {
    1112        if (typeof O === 'undefined' || O === null) {
     
    1516                throw new TypeError('hint must be "string" or "number"');
    1617        }
     18        /** @type {('toString' | 'valueOf')[]} */
    1719        var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString'];
    1820        var method, result, i;
     
    2931};
    3032
     33/** @type {<K extends PropertyKey>(O: Record<K, unknown>, P: K) => Function | undefined} */
    3134var GetMethod = function GetMethod(O, P) {
    3235        var func = O[P];
    3336        if (func !== null && typeof func !== 'undefined') {
    3437                if (!isCallable(func)) {
    35                         throw new TypeError(func + ' returned for property ' + P + ' of object ' + O + ' is not a function');
     38                        throw new TypeError(func + ' returned for property ' + String(P) + ' of object ' + O + ' is not a function');
    3639                }
    3740                return func;
     
    4043};
    4144
     45/** @type {import('./es2015')} */
    4246// http://www.ecma-international.org/ecma-262/6.0/#sec-toprimitive
    4347module.exports = function ToPrimitive(input) {
     
    4549                return input;
    4650        }
     51        /** @type {'default' | 'string' | 'number'} */
    4752        var hint = 'default';
    4853        if (arguments.length > 1) {
     
    5762        if (hasSymbols) {
    5863                if (Symbol.toPrimitive) {
    59                         exoticToPrim = GetMethod(input, Symbol.toPrimitive);
     64                        // eslint-disable-next-line no-extra-parens
     65                        exoticToPrim = GetMethod(/** @type {Record<PropertyKey, unknown>} */ (input), Symbol.toPrimitive);
    6066                } else if (isSymbol(input)) {
    6167                        exoticToPrim = Symbol.prototype.valueOf;
     
    7278                hint = 'string';
    7379        }
    74         return ordinaryToPrimitive(input, hint === 'default' ? 'number' : hint);
     80        // eslint-disable-next-line no-extra-parens
     81        return ordinaryToPrimitive(/** @type {object} */ (input), hint === 'default' ? 'number' : hint);
    7582};
  • imaps-frontend/node_modules/es-to-primitive/es5.js

    rd565449 r0c6b92a  
    77var isCallable = require('is-callable');
    88
     9/** @type {{ [k in `[[${string}]]`]: (O: { toString?: unknown, valueOf?: unknown }, actualHint?: StringConstructor | NumberConstructor) => null | undefined | string | symbol | number | boolean | bigint; }} */
    910// http://ecma-international.org/ecma-262/5.1/#sec-8.12.8
    1011var ES5internalSlots = {
     
    1819
    1920                if (actualHint === String || actualHint === Number) {
     21                        /** @type {('toString' | 'valueOf')[]} */
    2022                        var methods = actualHint === String ? ['toString', 'valueOf'] : ['valueOf', 'toString'];
    2123                        var value, i;
    2224                        for (i = 0; i < methods.length; ++i) {
    23                                 if (isCallable(O[methods[i]])) {
    24                                         value = O[methods[i]]();
     25                                var method = methods[i];
     26                                if (isCallable(O[method])) {
     27                                        // eslint-disable-next-line no-extra-parens
     28                                        value = /** @type {Function} */ (O[method])();
    2529                                        if (isPrimitive(value)) {
    2630                                                return value;
     
    3438};
    3539
     40/** @type {import('./es5')} */
    3641// http://ecma-international.org/ecma-262/5.1/#sec-9.1
    3742module.exports = function ToPrimitive(input) {
     
    4045        }
    4146        if (arguments.length > 1) {
    42                 return ES5internalSlots['[[DefaultValue]]'](input, arguments[1]);
     47                // eslint-disable-next-line no-extra-parens
     48                return ES5internalSlots['[[DefaultValue]]'](/** @type {object} */ (input), arguments[1]);
    4349        }
    44         return ES5internalSlots['[[DefaultValue]]'](input);
     50        // eslint-disable-next-line no-extra-parens
     51        return ES5internalSlots['[[DefaultValue]]'](/** @type {object} */ (input));
    4552};
  • imaps-frontend/node_modules/es-to-primitive/es6.js

    rd565449 r0c6b92a  
    11'use strict';
    22
     3/** @type {import('./es2015')} */
    34module.exports = require('./es2015');
  • imaps-frontend/node_modules/es-to-primitive/helpers/isPrimitive.js

    rd565449 r0c6b92a  
    11'use strict';
    22
     3/** @type {(value: unknown) => value is null | undefined | string | symbol | number | boolean | bigint} */
    34module.exports = function isPrimitive(value) {
    45        return value === null || (typeof value !== 'function' && typeof value !== 'object');
  • imaps-frontend/node_modules/es-to-primitive/index.js

    rd565449 r0c6b92a  
    1010        Object.defineProperty(ES2015, 'ES2015', { enumerable: false, value: ES2015 });
    1111} else {
    12         ES6.ES5 = ES5;
    13         ES6.ES6 = ES6;
    14         ES6.ES2015 = ES2015;
     12        // @ts-expect-error TODO
     13        ES2015.ES5 = ES5;
     14        // @ts-expect-error TODO
     15        ES2015.ES6 = ES6;
     16        // @ts-expect-error TODO
     17        ES2015.ES2015 = ES2015;
    1518}
    1619
     20/** @type {import('.')} */
    1721module.exports = ES2015;
  • imaps-frontend/node_modules/es-to-primitive/package.json

    rd565449 r0c6b92a  
    11{
    22        "name": "es-to-primitive",
    3         "version": "1.2.1",
     3        "version": "1.3.0",
    44        "author": "Jordan Harband <ljharb@gmail.com>",
    55        "funding": {
     
    1010        "main": "index.js",
    1111        "scripts": {
    12                 "pretest": "npm run --silent lint",
    13                 "test": "npm run --silent tests-only",
    14                 "posttest": "npx aud",
    15                 "tests-only": "node --es-staging test",
    16                 "coverage": "covert test/*.js",
    17                 "coverage-quiet": "covert test/*.js --quiet",
    18                 "lint": "eslint ."
     12                "prepack": "npmignore --auto --commentLines=autogenerated",
     13                "prepublish": "not-in-publish || npm run prepublishOnly",
     14                "prepublishOnly": "safe-publish-latest",
     15                "pretest": "npm run lint",
     16                "test": "npm run tests-only",
     17                "posttest": "npx npm@'>=10.2' audit --production",
     18                "tests-only": "nyc tape 'test/**/*.js'",
     19                "lint": "eslint --ext=js,mjs .",
     20                "postlint": "tsc && attw -P",
     21                "version": "auto-changelog && git add CHANGELOG.md",
     22                "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
    1923        },
    2024        "repository": {
     
    4145        ],
    4246        "dependencies": {
    43                 "is-callable": "^1.1.4",
    44                 "is-date-object": "^1.0.1",
    45                 "is-symbol": "^1.0.2"
     47                "is-callable": "^1.2.7",
     48                "is-date-object": "^1.0.5",
     49                "is-symbol": "^1.0.4"
    4650        },
    4751        "devDependencies": {
    48                 "@ljharb/eslint-config": "^15.0.0",
    49                 "covert": "^1.1.1",
    50                 "eslint": "^6.6.0",
    51                 "foreach": "^2.0.5",
    52                 "function.prototype.name": "^1.1.1",
    53                 "has-symbols": "^1.0.0",
    54                 "object-inspect": "^1.6.0",
    55                 "object-is": "^1.0.1",
    56                 "replace": "^1.1.1",
    57                 "semver": "^6.3.0",
    58                 "tape": "^4.11.0"
     52                "@arethetypeswrong/cli": "^0.17.0",
     53                "@ljharb/eslint-config": "^21.1.1",
     54                "@ljharb/tsconfig": "^0.2.0",
     55                "@types/for-each": "^0.3.3",
     56                "@types/function.prototype.name": "^1.1.3",
     57                "@types/is-callable": "^1.1.2",
     58                "@types/is-date-object": "^1.0.4",
     59                "@types/is-symbol": "^1.0.2",
     60                "@types/object-inspect": "^1.13.0",
     61                "@types/object-is": "^1.1.0",
     62                "@types/tape": "^5.6.4",
     63                "auto-changelog": "^2.5.0",
     64                "encoding": "^0.1.13",
     65                "es-value-fixtures": "^1.5.0",
     66                "eslint": "=8.8.0",
     67                "for-each": "^0.3.3",
     68                "function.prototype.name": "^1.1.6",
     69                "npmignore": "^0.3.1",
     70                "nyc": "^10.3.2",
     71                "object-inspect": "^1.13.3",
     72                "object-is": "^1.1.6",
     73                "safe-publish-latest": "^2.0.0",
     74                "tape": "^5.9.0",
     75                "typescript": "next"
    5976        },
    6077        "testling": {
    61                 "files": "test",
    62                 "browsers": [
    63                         "iexplore/6.0..latest",
    64                         "firefox/3.0..6.0",
    65                         "firefox/15.0..latest",
    66                         "firefox/nightly",
    67                         "chrome/4.0..10.0",
    68                         "chrome/20.0..latest",
    69                         "chrome/canary",
    70                         "opera/10.0..latest",
    71                         "opera/next",
    72                         "safari/4.0..latest",
    73                         "ipad/6.0..latest",
    74                         "iphone/6.0..latest",
    75                         "android-browser/4.2"
    76                 ]
     78                "files": "test/index.js"
    7779        },
    7880        "engines": {
    7981                "node": ">= 0.4"
     82        },
     83        "auto-changelog": {
     84                "output": "CHANGELOG.md",
     85                "template": "keepachangelog",
     86                "unreleased": false,
     87                "commitLimit": false,
     88                "backfillLimit": false,
     89                "hideCredit": true,
     90                "startingVersion": "1.2.2"
     91        },
     92        "publishConfig": {
     93                "ignore": [
     94                        ".github/workflows"
     95                ]
    8096        }
    8197}
  • imaps-frontend/node_modules/es-to-primitive/test/es2015.js

    rd565449 r0c6b92a  
    44var toPrimitive = require('../es2015');
    55var is = require('object-is');
    6 var forEach = require('foreach');
     6var forEach = require('for-each');
    77var functionName = require('function.prototype.name');
    88var debug = require('object-inspect');
     9var v = require('es-value-fixtures');
    910
    10 var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol';
    11 var hasSymbolToPrimitive = hasSymbols && typeof Symbol.toPrimitive === 'symbol';
     11/** @typedef {{ toString?: unknown, valueOf?: unknown, [Symbol.toPrimitive]?: unknown }} Coercible */
    1212
    1313test('function properties', function (t) {
     
    1818});
    1919
    20 var primitives = [null, undefined, true, false, 0, -0, 42, NaN, Infinity, -Infinity, '', 'abc'];
    21 
    2220test('primitives', function (t) {
    23         forEach(primitives, function (i) {
     21        forEach(v.primitives, function (i) {
    2422                t.ok(is(toPrimitive(i), i), 'toPrimitive(' + debug(i) + ') returns the same value');
    2523                t.ok(is(toPrimitive(i, String), i), 'toPrimitive(' + debug(i) + ', String) returns the same value');
     
    2927});
    3028
    31 test('Symbols', { skip: !hasSymbols }, function (t) {
    32         var symbols = [
    33                 Symbol('foo'),
    34                 Symbol.iterator,
    35                 Symbol['for']('foo') // eslint-disable-line no-restricted-properties
    36         ];
    37         forEach(symbols, function (sym) {
     29test('Symbols', { skip: !v.hasSymbols }, function (t) {
     30        forEach(v.symbols, function (sym) {
    3831                t.equal(toPrimitive(sym), sym, 'toPrimitive(' + debug(sym) + ') returns the same value');
    3932                t.equal(toPrimitive(sym, String), sym, 'toPrimitive(' + debug(sym) + ', String) returns the same value');
     
    6962});
    7063
    71 var coercibleObject = { valueOf: function () { return 3; }, toString: function () { return 42; } };
    72 var valueOfOnlyObject = { valueOf: function () { return 4; }, toString: function () { return {}; } };
    73 var toStringOnlyObject = { valueOf: function () { return {}; }, toString: function () { return 7; } };
    74 var coercibleFnObject = {
    75         valueOf: function () { return function valueOfFn() {}; },
    76         toString: function () { return 42; }
    77 };
    78 var uncoercibleObject = { valueOf: function () { return {}; }, toString: function () { return {}; } };
    79 var uncoercibleFnObject = {
    80         valueOf: function () { return function valueOfFn() {}; },
    81         toString: function () { return function toStrFn() {}; }
    82 };
     64test('Objects', function (t) {
     65        t.equal(toPrimitive(v.coercibleObject), v.coercibleObject.valueOf(), 'coercibleObject with no hint coerces to valueOf');
     66        t.equal(toPrimitive(v.coercibleObject, Number), v.coercibleObject.valueOf(), 'coercibleObject with hint Number coerces to valueOf');
     67        t.equal(toPrimitive(v.coercibleObject, String), v.coercibleObject.toString(), 'coercibleObject with hint String coerces to non-stringified toString');
    8368
    84 test('Objects', function (t) {
    85         t.equal(toPrimitive(coercibleObject), coercibleObject.valueOf(), 'coercibleObject with no hint coerces to valueOf');
    86         t.equal(toPrimitive(coercibleObject, Number), coercibleObject.valueOf(), 'coercibleObject with hint Number coerces to valueOf');
    87         t.equal(toPrimitive(coercibleObject, String), coercibleObject.toString(), 'coercibleObject with hint String coerces to non-stringified toString');
    88 
    89         t.equal(toPrimitive(coercibleFnObject), coercibleFnObject.toString(), 'coercibleFnObject coerces to non-stringified toString');
    90         t.equal(toPrimitive(coercibleFnObject, Number), coercibleFnObject.toString(), 'coercibleFnObject with hint Number coerces to non-stringified toString');
    91         t.equal(toPrimitive(coercibleFnObject, String), coercibleFnObject.toString(), 'coercibleFnObject with hint String coerces to non-stringified toString');
     69        t.equal(toPrimitive(v.coercibleFnObject), v.coercibleFnObject.toString(), 'coercibleFnObject coerces to non-stringified toString');
     70        t.equal(toPrimitive(v.coercibleFnObject, Number), v.coercibleFnObject.toString(), 'coercibleFnObject with hint Number coerces to non-stringified toString');
     71        t.equal(toPrimitive(v.coercibleFnObject, String), v.coercibleFnObject.toString(), 'coercibleFnObject with hint String coerces to non-stringified toString');
    9272
    9373        t.equal(toPrimitive({}), '[object Object]', '{} with no hint coerces to Object#toString');
     
    9575        t.equal(toPrimitive({}, String), '[object Object]', '{} with hint String coerces to Object#toString');
    9676
    97         t.equal(toPrimitive(toStringOnlyObject), toStringOnlyObject.toString(), 'toStringOnlyObject returns non-stringified toString');
    98         t.equal(toPrimitive(toStringOnlyObject, Number), toStringOnlyObject.toString(), 'toStringOnlyObject with hint Number returns non-stringified toString');
    99         t.equal(toPrimitive(toStringOnlyObject, String), toStringOnlyObject.toString(), 'toStringOnlyObject with hint String returns non-stringified toString');
     77        t.equal(toPrimitive(v.toStringOnlyObject), v.toStringOnlyObject.toString(), 'toStringOnlyObject returns non-stringified toString');
     78        t.equal(toPrimitive(v.toStringOnlyObject, Number), v.toStringOnlyObject.toString(), 'toStringOnlyObject with hint Number returns non-stringified toString');
     79        t.equal(toPrimitive(v.toStringOnlyObject, String), v.toStringOnlyObject.toString(), 'toStringOnlyObject with hint String returns non-stringified toString');
    10080
    101         t.equal(toPrimitive(valueOfOnlyObject), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject returns valueOf');
    102         t.equal(toPrimitive(valueOfOnlyObject, Number), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint Number returns valueOf');
    103         t.equal(toPrimitive(valueOfOnlyObject, String), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint String returns non-stringified valueOf');
     81        t.equal(toPrimitive(v.valueOfOnlyObject), v.valueOfOnlyObject.valueOf(), 'valueOfOnlyObject returns valueOf');
     82        t.equal(toPrimitive(v.valueOfOnlyObject, Number), v.valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint Number returns valueOf');
     83        t.equal(toPrimitive(v.valueOfOnlyObject, String), v.valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint String returns non-stringified valueOf');
    10484
    105         t.test('Symbol.toPrimitive', { skip: !hasSymbolToPrimitive }, function (st) {
     85        t.test('Symbol.toPrimitive', { skip: !v.hasSymbols || !Symbol.toPrimitive }, function (st) {
     86                /** @type {Coercible} */
    10687                var overriddenObject = { toString: st.fail, valueOf: st.fail };
    107                 overriddenObject[Symbol.toPrimitive] = function (hint) { return String(hint); };
     88                overriddenObject[Symbol.toPrimitive] = /** @type {(hint: string) => unknown} */ function (hint) {
     89                        return String(hint);
     90                };
    10891
    10992                st.equal(toPrimitive(overriddenObject), 'default', 'object with Symbol.toPrimitive + no hint invokes that');
     
    11194                st.equal(toPrimitive(overriddenObject, String), 'string', 'object with Symbol.toPrimitive + hint String invokes that');
    11295
    113                 var nullToPrimitive = { toString: coercibleObject.toString, valueOf: coercibleObject.valueOf };
     96                /** @type {Coercible} */
     97                var nullToPrimitive = { toString: v.coercibleObject.toString, valueOf: v.coercibleObject.valueOf };
    11498                nullToPrimitive[Symbol.toPrimitive] = null;
    115                 st.equal(toPrimitive(nullToPrimitive), toPrimitive(coercibleObject), 'object with no hint + null Symbol.toPrimitive ignores it');
    116                 st.equal(toPrimitive(nullToPrimitive, Number), toPrimitive(coercibleObject, Number), 'object with hint Number + null Symbol.toPrimitive ignores it');
    117                 st.equal(toPrimitive(nullToPrimitive, String), toPrimitive(coercibleObject, String), 'object with hint String + null Symbol.toPrimitive ignores it');
     99                st.equal(toPrimitive(nullToPrimitive), toPrimitive(v.coercibleObject), 'object with no hint + null Symbol.toPrimitive ignores it');
     100                st.equal(toPrimitive(nullToPrimitive, Number), toPrimitive(v.coercibleObject, Number), 'object with hint Number + null Symbol.toPrimitive ignores it');
     101                st.equal(toPrimitive(nullToPrimitive, String), toPrimitive(v.coercibleObject, String), 'object with hint String + null Symbol.toPrimitive ignores it');
    118102
    119103                st.test('exceptions', function (sst) {
     104                        /** @type {Coercible} */
    120105                        var nonFunctionToPrimitive = { toString: sst.fail, valueOf: sst.fail };
    121106                        nonFunctionToPrimitive[Symbol.toPrimitive] = {};
    122107                        sst['throws'](toPrimitive.bind(null, nonFunctionToPrimitive), TypeError, 'Symbol.toPrimitive returning a non-function throws');
    123108
     109                        /** @type {Coercible} */
    124110                        var uncoercibleToPrimitive = { toString: sst.fail, valueOf: sst.fail };
    125                         uncoercibleToPrimitive[Symbol.toPrimitive] = function (hint) {
     111                        uncoercibleToPrimitive[Symbol.toPrimitive] = /** @type {(hint: string) => unknown} */ function (hint) {
    126112                                return { toString: function () { return hint; } };
    127113                        };
    128114                        sst['throws'](toPrimitive.bind(null, uncoercibleToPrimitive), TypeError, 'Symbol.toPrimitive returning an object throws');
    129115
     116                        /** @type {Coercible} */
    130117                        var throwingToPrimitive = { toString: sst.fail, valueOf: sst.fail };
    131                         throwingToPrimitive[Symbol.toPrimitive] = function (hint) { throw new RangeError(hint); };
     118                        throwingToPrimitive[Symbol.toPrimitive] = /** @type {(hint: string) => unknown} */ function (hint) {
     119                                throw new RangeError(hint);
     120                        };
    132121                        sst['throws'](toPrimitive.bind(null, throwingToPrimitive), RangeError, 'Symbol.toPrimitive throwing throws');
    133122
     
    139128
    140129        t.test('exceptions', function (st) {
    141                 st['throws'](toPrimitive.bind(null, uncoercibleObject), TypeError, 'uncoercibleObject throws a TypeError');
    142                 st['throws'](toPrimitive.bind(null, uncoercibleObject, Number), TypeError, 'uncoercibleObject with hint Number throws a TypeError');
    143                 st['throws'](toPrimitive.bind(null, uncoercibleObject, String), TypeError, 'uncoercibleObject with hint String throws a TypeError');
     130                st['throws'](toPrimitive.bind(null, v.uncoercibleObject), TypeError, 'uncoercibleObject throws a TypeError');
     131                st['throws'](toPrimitive.bind(null, v.uncoercibleObject, Number), TypeError, 'uncoercibleObject with hint Number throws a TypeError');
     132                st['throws'](toPrimitive.bind(null, v.uncoercibleObject, String), TypeError, 'uncoercibleObject with hint String throws a TypeError');
    144133
    145                 st['throws'](toPrimitive.bind(null, uncoercibleFnObject), TypeError, 'uncoercibleFnObject throws a TypeError');
    146                 st['throws'](toPrimitive.bind(null, uncoercibleFnObject, Number), TypeError, 'uncoercibleFnObject with hint Number throws a TypeError');
    147                 st['throws'](toPrimitive.bind(null, uncoercibleFnObject, String), TypeError, 'uncoercibleFnObject with hint String throws a TypeError');
     134                st['throws'](toPrimitive.bind(null, v.uncoercibleFnObject), TypeError, 'uncoercibleFnObject throws a TypeError');
     135                st['throws'](toPrimitive.bind(null, v.uncoercibleFnObject, Number), TypeError, 'uncoercibleFnObject with hint Number throws a TypeError');
     136                st['throws'](toPrimitive.bind(null, v.uncoercibleFnObject, String), TypeError, 'uncoercibleFnObject with hint String throws a TypeError');
    148137                st.end();
    149138        });
  • imaps-frontend/node_modules/es-to-primitive/test/es5.js

    rd565449 r0c6b92a  
    44var toPrimitive = require('../es5');
    55var is = require('object-is');
    6 var forEach = require('foreach');
     6var forEach = require('for-each');
    77var functionName = require('function.prototype.name');
    88var debug = require('object-inspect');
    9 var hasSymbols = require('has-symbols')();
     9var v = require('es-value-fixtures');
    1010
    1111test('function properties', function (t) {
     
    1616});
    1717
    18 var primitives = [null, undefined, true, false, 0, -0, 42, NaN, Infinity, -Infinity, '', 'abc'];
    19 
    2018test('primitives', function (t) {
    21         forEach(primitives, function (i) {
     19        forEach(v.primitives, function (i) {
    2220                t.ok(is(toPrimitive(i), i), 'toPrimitive(' + debug(i) + ') returns the same value');
    2321                t.ok(is(toPrimitive(i, String), i), 'toPrimitive(' + debug(i) + ', String) returns the same value');
     
    2725});
    2826
    29 test('Symbols', { skip: !hasSymbols }, function (t) {
    30         var symbols = [
    31                 Symbol('foo'),
    32                 Symbol.iterator,
    33                 Symbol['for']('foo') // eslint-disable-line no-restricted-properties
    34         ];
    35         forEach(symbols, function (sym) {
     27test('Symbols', { skip: !v.hasSymbols }, function (t) {
     28        forEach(v.symbols, function (sym) {
    3629                t.equal(toPrimitive(sym), sym, 'toPrimitive(' + debug(sym) + ') returns the same value');
    3730                t.equal(toPrimitive(sym, String), sym, 'toPrimitive(' + debug(sym) + ', String) returns the same value');
     
    7063});
    7164
    72 var coercibleObject = { valueOf: function () { return 3; }, toString: function () { return 42; } };
    73 var valueOfOnlyObject = { valueOf: function () { return 4; }, toString: function () { return {}; } };
    74 var toStringOnlyObject = { valueOf: function () { return {}; }, toString: function () { return 7; } };
    75 var coercibleFnObject = {
    76         valueOf: function () { return function valueOfFn() {}; },
    77         toString: function () { return 42; }
    78 };
    79 var uncoercibleObject = { valueOf: function () { return {}; }, toString: function () { return {}; } };
    80 var uncoercibleFnObject = {
    81         valueOf: function () { return function valueOfFn() {}; },
    82         toString: function () { return function toStrFn() {}; }
    83 };
     65test('Objects', function (t) {
     66        t.equal(toPrimitive(v.coercibleObject), v.coercibleObject.valueOf(), 'coercibleObject with no hint coerces to valueOf');
     67        t.equal(toPrimitive(v.coercibleObject, String), v.coercibleObject.toString(), 'coercibleObject with hint String coerces to toString');
     68        t.equal(toPrimitive(v.coercibleObject, Number), v.coercibleObject.valueOf(), 'coercibleObject with hint Number coerces to valueOf');
    8469
    85 test('Objects', function (t) {
    86         t.equal(toPrimitive(coercibleObject), coercibleObject.valueOf(), 'coercibleObject with no hint coerces to valueOf');
    87         t.equal(toPrimitive(coercibleObject, String), coercibleObject.toString(), 'coercibleObject with hint String coerces to toString');
    88         t.equal(toPrimitive(coercibleObject, Number), coercibleObject.valueOf(), 'coercibleObject with hint Number coerces to valueOf');
    89 
    90         t.equal(toPrimitive(coercibleFnObject), coercibleFnObject.toString(), 'coercibleFnObject coerces to toString');
    91         t.equal(toPrimitive(coercibleFnObject, String), coercibleFnObject.toString(), 'coercibleFnObject with hint String coerces to toString');
    92         t.equal(toPrimitive(coercibleFnObject, Number), coercibleFnObject.toString(), 'coercibleFnObject with hint Number coerces to toString');
     70        t.equal(toPrimitive(v.coercibleFnObject), v.coercibleFnObject.toString(), 'coercibleFnObject coerces to toString');
     71        t.equal(toPrimitive(v.coercibleFnObject, String), v.coercibleFnObject.toString(), 'coercibleFnObject with hint String coerces to toString');
     72        t.equal(toPrimitive(v.coercibleFnObject, Number), v.coercibleFnObject.toString(), 'coercibleFnObject with hint Number coerces to toString');
    9373
    9474        t.ok(is(toPrimitive({}), '[object Object]'), '{} with no hint coerces to Object#toString');
     
    9676        t.ok(is(toPrimitive({}, Number), '[object Object]'), '{} with hint Number coerces to Object#toString');
    9777
    98         t.equal(toPrimitive(toStringOnlyObject), toStringOnlyObject.toString(), 'toStringOnlyObject returns toString');
    99         t.equal(toPrimitive(toStringOnlyObject, String), toStringOnlyObject.toString(), 'toStringOnlyObject with hint String returns toString');
    100         t.equal(toPrimitive(toStringOnlyObject, Number), toStringOnlyObject.toString(), 'toStringOnlyObject with hint Number returns toString');
     78        t.equal(toPrimitive(v.toStringOnlyObject), v.toStringOnlyObject.toString(), 'toStringOnlyObject returns toString');
     79        t.equal(toPrimitive(v.toStringOnlyObject, String), v.toStringOnlyObject.toString(), 'toStringOnlyObject with hint String returns toString');
     80        t.equal(toPrimitive(v.toStringOnlyObject, Number), v.toStringOnlyObject.toString(), 'toStringOnlyObject with hint Number returns toString');
    10181
    102         t.equal(toPrimitive(valueOfOnlyObject), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject returns valueOf');
    103         t.equal(toPrimitive(valueOfOnlyObject, String), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint String returns valueOf');
    104         t.equal(toPrimitive(valueOfOnlyObject, Number), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint Number returns valueOf');
     82        t.equal(toPrimitive(v.valueOfOnlyObject), v.valueOfOnlyObject.valueOf(), 'valueOfOnlyObject returns valueOf');
     83        t.equal(toPrimitive(v.valueOfOnlyObject, String), v.valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint String returns valueOf');
     84        t.equal(toPrimitive(v.valueOfOnlyObject, Number), v.valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint Number returns valueOf');
    10585
    10686        t.test('exceptions', function (st) {
    107                 st['throws'](toPrimitive.bind(null, uncoercibleObject), TypeError, 'uncoercibleObject throws a TypeError');
    108                 st['throws'](toPrimitive.bind(null, uncoercibleObject, String), TypeError, 'uncoercibleObject with hint String throws a TypeError');
    109                 st['throws'](toPrimitive.bind(null, uncoercibleObject, Number), TypeError, 'uncoercibleObject with hint Number throws a TypeError');
     87                st['throws'](toPrimitive.bind(null, v.uncoercibleObject), TypeError, 'uncoercibleObject throws a TypeError');
     88                st['throws'](toPrimitive.bind(null, v.uncoercibleObject, String), TypeError, 'uncoercibleObject with hint String throws a TypeError');
     89                st['throws'](toPrimitive.bind(null, v.uncoercibleObject, Number), TypeError, 'uncoercibleObject with hint Number throws a TypeError');
    11090
    111                 st['throws'](toPrimitive.bind(null, uncoercibleFnObject), TypeError, 'uncoercibleFnObject throws a TypeError');
    112                 st['throws'](toPrimitive.bind(null, uncoercibleFnObject, String), TypeError, 'uncoercibleFnObject with hint String throws a TypeError');
    113                 st['throws'](toPrimitive.bind(null, uncoercibleFnObject, Number), TypeError, 'uncoercibleFnObject with hint Number throws a TypeError');
     91                st['throws'](toPrimitive.bind(null, v.uncoercibleFnObject), TypeError, 'uncoercibleFnObject throws a TypeError');
     92                st['throws'](toPrimitive.bind(null, v.uncoercibleFnObject, String), TypeError, 'uncoercibleFnObject with hint String throws a TypeError');
     93                st['throws'](toPrimitive.bind(null, v.uncoercibleFnObject, Number), TypeError, 'uncoercibleFnObject with hint Number throws a TypeError');
    11494                st.end();
    11595        });
  • imaps-frontend/node_modules/es-to-primitive/test/es6.js

    rd565449 r0c6b92a  
    44var toPrimitive = require('../es6');
    55var is = require('object-is');
    6 var forEach = require('foreach');
     6var forEach = require('for-each');
    77var functionName = require('function.prototype.name');
    88var debug = require('object-inspect');
     9var v = require('es-value-fixtures');
    910
    10 var hasSymbols = require('has-symbols')();
    11 var hasSymbolToPrimitive = hasSymbols && typeof Symbol.toPrimitive === 'symbol';
     11/** @typedef {{ toString?: unknown, valueOf?: unknown, [Symbol.toPrimitive]?: unknown }} Coercible */
    1212
    1313test('function properties', function (t) {
     
    1818});
    1919
    20 var primitives = [null, undefined, true, false, 0, -0, 42, NaN, Infinity, -Infinity, '', 'abc'];
    21 
    2220test('primitives', function (t) {
    23         forEach(primitives, function (i) {
     21        forEach(v.primitives, function (i) {
    2422                t.ok(is(toPrimitive(i), i), 'toPrimitive(' + debug(i) + ') returns the same value');
    2523                t.ok(is(toPrimitive(i, String), i), 'toPrimitive(' + debug(i) + ', String) returns the same value');
     
    2927});
    3028
    31 test('Symbols', { skip: !hasSymbols }, function (t) {
    32         var symbols = [
    33                 Symbol('foo'),
    34                 Symbol.iterator,
    35                 Symbol['for']('foo') // eslint-disable-line no-restricted-properties
    36         ];
    37         forEach(symbols, function (sym) {
     29test('Symbols', { skip: !v.hasSymbols }, function (t) {
     30        forEach(v.symbols, function (sym) {
    3831                t.equal(toPrimitive(sym), sym, 'toPrimitive(' + debug(sym) + ') returns the same value');
    3932                t.equal(toPrimitive(sym, String), sym, 'toPrimitive(' + debug(sym) + ', String) returns the same value');
     
    6962});
    7063
    71 var coercibleObject = { valueOf: function () { return 3; }, toString: function () { return 42; } };
    72 var valueOfOnlyObject = { valueOf: function () { return 4; }, toString: function () { return {}; } };
    73 var toStringOnlyObject = { valueOf: function () { return {}; }, toString: function () { return 7; } };
    74 var coercibleFnObject = {
    75         valueOf: function () { return function valueOfFn() {}; },
    76         toString: function () { return 42; }
    77 };
    78 var uncoercibleObject = { valueOf: function () { return {}; }, toString: function () { return {}; } };
    79 var uncoercibleFnObject = {
    80         valueOf: function () { return function valueOfFn() {}; },
    81         toString: function () { return function toStrFn() {}; }
    82 };
     64test('Objects', function (t) {
     65        t.equal(toPrimitive(v.coercibleObject), v.coercibleObject.valueOf(), 'coercibleObject with no hint coerces to valueOf');
     66        t.equal(toPrimitive(v.coercibleObject, Number), v.coercibleObject.valueOf(), 'coercibleObject with hint Number coerces to valueOf');
     67        t.equal(toPrimitive(v.coercibleObject, String), v.coercibleObject.toString(), 'coercibleObject with hint String coerces to non-stringified toString');
    8368
    84 test('Objects', function (t) {
    85         t.equal(toPrimitive(coercibleObject), coercibleObject.valueOf(), 'coercibleObject with no hint coerces to valueOf');
    86         t.equal(toPrimitive(coercibleObject, Number), coercibleObject.valueOf(), 'coercibleObject with hint Number coerces to valueOf');
    87         t.equal(toPrimitive(coercibleObject, String), coercibleObject.toString(), 'coercibleObject with hint String coerces to non-stringified toString');
    88 
    89         t.equal(toPrimitive(coercibleFnObject), coercibleFnObject.toString(), 'coercibleFnObject coerces to non-stringified toString');
    90         t.equal(toPrimitive(coercibleFnObject, Number), coercibleFnObject.toString(), 'coercibleFnObject with hint Number coerces to non-stringified toString');
    91         t.equal(toPrimitive(coercibleFnObject, String), coercibleFnObject.toString(), 'coercibleFnObject with hint String coerces to non-stringified toString');
     69        t.equal(toPrimitive(v.coercibleFnObject), v.coercibleFnObject.toString(), 'coercibleFnObject coerces to non-stringified toString');
     70        t.equal(toPrimitive(v.coercibleFnObject, Number), v.coercibleFnObject.toString(), 'coercibleFnObject with hint Number coerces to non-stringified toString');
     71        t.equal(toPrimitive(v.coercibleFnObject, String), v.coercibleFnObject.toString(), 'coercibleFnObject with hint String coerces to non-stringified toString');
    9272
    9373        t.equal(toPrimitive({}), '[object Object]', '{} with no hint coerces to Object#toString');
     
    9575        t.equal(toPrimitive({}, String), '[object Object]', '{} with hint String coerces to Object#toString');
    9676
    97         t.equal(toPrimitive(toStringOnlyObject), toStringOnlyObject.toString(), 'toStringOnlyObject returns non-stringified toString');
    98         t.equal(toPrimitive(toStringOnlyObject, Number), toStringOnlyObject.toString(), 'toStringOnlyObject with hint Number returns non-stringified toString');
    99         t.equal(toPrimitive(toStringOnlyObject, String), toStringOnlyObject.toString(), 'toStringOnlyObject with hint String returns non-stringified toString');
     77        t.equal(toPrimitive(v.toStringOnlyObject), v.toStringOnlyObject.toString(), 'toStringOnlyObject returns non-stringified toString');
     78        t.equal(toPrimitive(v.toStringOnlyObject, Number), v.toStringOnlyObject.toString(), 'toStringOnlyObject with hint Number returns non-stringified toString');
     79        t.equal(toPrimitive(v.toStringOnlyObject, String), v.toStringOnlyObject.toString(), 'toStringOnlyObject with hint String returns non-stringified toString');
    10080
    101         t.equal(toPrimitive(valueOfOnlyObject), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject returns valueOf');
    102         t.equal(toPrimitive(valueOfOnlyObject, Number), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint Number returns valueOf');
    103         t.equal(toPrimitive(valueOfOnlyObject, String), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint String returns non-stringified valueOf');
     81        t.equal(toPrimitive(v.valueOfOnlyObject), v.valueOfOnlyObject.valueOf(), 'valueOfOnlyObject returns valueOf');
     82        t.equal(toPrimitive(v.valueOfOnlyObject, Number), v.valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint Number returns valueOf');
     83        t.equal(toPrimitive(v.valueOfOnlyObject, String), v.valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint String returns non-stringified valueOf');
    10484
    105         t.test('Symbol.toPrimitive', { skip: !hasSymbolToPrimitive }, function (st) {
     85        t.test('Symbol.toPrimitive', { skip: !v.hasSymbols || !Symbol.toPrimitive }, function (st) {
     86                /** @type {Coercible} */
    10687                var overriddenObject = { toString: st.fail, valueOf: st.fail };
    107                 overriddenObject[Symbol.toPrimitive] = function (hint) { return String(hint); };
     88                overriddenObject[Symbol.toPrimitive] = /** @type {(hint: string) => unknown} */ function (hint) {
     89                        return String(hint);
     90                };
    10891
    10992                st.equal(toPrimitive(overriddenObject), 'default', 'object with Symbol.toPrimitive + no hint invokes that');
     
    11194                st.equal(toPrimitive(overriddenObject, String), 'string', 'object with Symbol.toPrimitive + hint String invokes that');
    11295
    113                 var nullToPrimitive = { toString: coercibleObject.toString, valueOf: coercibleObject.valueOf };
     96                /** @type {Coercible} */
     97                var nullToPrimitive = { toString: v.coercibleObject.toString, valueOf: v.coercibleObject.valueOf };
    11498                nullToPrimitive[Symbol.toPrimitive] = null;
    115                 st.equal(toPrimitive(nullToPrimitive), toPrimitive(coercibleObject), 'object with no hint + null Symbol.toPrimitive ignores it');
    116                 st.equal(toPrimitive(nullToPrimitive, Number), toPrimitive(coercibleObject, Number), 'object with hint Number + null Symbol.toPrimitive ignores it');
    117                 st.equal(toPrimitive(nullToPrimitive, String), toPrimitive(coercibleObject, String), 'object with hint String + null Symbol.toPrimitive ignores it');
     99                st.equal(toPrimitive(nullToPrimitive), toPrimitive(v.coercibleObject), 'object with no hint + null Symbol.toPrimitive ignores it');
     100                st.equal(toPrimitive(nullToPrimitive, Number), toPrimitive(v.coercibleObject, Number), 'object with hint Number + null Symbol.toPrimitive ignores it');
     101                st.equal(toPrimitive(nullToPrimitive, String), toPrimitive(v.coercibleObject, String), 'object with hint String + null Symbol.toPrimitive ignores it');
    118102
    119103                st.test('exceptions', function (sst) {
     104                        /** @type {Coercible} */
    120105                        var nonFunctionToPrimitive = { toString: sst.fail, valueOf: sst.fail };
    121106                        nonFunctionToPrimitive[Symbol.toPrimitive] = {};
    122107                        sst['throws'](toPrimitive.bind(null, nonFunctionToPrimitive), TypeError, 'Symbol.toPrimitive returning a non-function throws');
    123108
     109                        /** @type {Coercible} */
    124110                        var uncoercibleToPrimitive = { toString: sst.fail, valueOf: sst.fail };
    125                         uncoercibleToPrimitive[Symbol.toPrimitive] = function (hint) {
     111                        uncoercibleToPrimitive[Symbol.toPrimitive] = /** @type {(hint: string) => unknown} */ function (hint) {
    126112                                return { toString: function () { return hint; } };
    127113                        };
    128114                        sst['throws'](toPrimitive.bind(null, uncoercibleToPrimitive), TypeError, 'Symbol.toPrimitive returning an object throws');
    129115
     116                        /** @type {Coercible} */
    130117                        var throwingToPrimitive = { toString: sst.fail, valueOf: sst.fail };
    131                         throwingToPrimitive[Symbol.toPrimitive] = function (hint) { throw new RangeError(hint); };
     118                        throwingToPrimitive[Symbol.toPrimitive] = /** @type {(hint: string) => unknown} */ function (hint) {
     119                                throw new RangeError(hint);
     120                        };
    132121                        sst['throws'](toPrimitive.bind(null, throwingToPrimitive), RangeError, 'Symbol.toPrimitive throwing throws');
    133122
     
    139128
    140129        t.test('exceptions', function (st) {
    141                 st['throws'](toPrimitive.bind(null, uncoercibleObject), TypeError, 'uncoercibleObject throws a TypeError');
    142                 st['throws'](toPrimitive.bind(null, uncoercibleObject, Number), TypeError, 'uncoercibleObject with hint Number throws a TypeError');
    143                 st['throws'](toPrimitive.bind(null, uncoercibleObject, String), TypeError, 'uncoercibleObject with hint String throws a TypeError');
     130                st['throws'](toPrimitive.bind(null, v.uncoercibleObject), TypeError, 'uncoercibleObject throws a TypeError');
     131                st['throws'](toPrimitive.bind(null, v.uncoercibleObject, Number), TypeError, 'uncoercibleObject with hint Number throws a TypeError');
     132                st['throws'](toPrimitive.bind(null, v.uncoercibleObject, String), TypeError, 'uncoercibleObject with hint String throws a TypeError');
    144133
    145                 st['throws'](toPrimitive.bind(null, uncoercibleFnObject), TypeError, 'uncoercibleFnObject throws a TypeError');
    146                 st['throws'](toPrimitive.bind(null, uncoercibleFnObject, Number), TypeError, 'uncoercibleFnObject with hint Number throws a TypeError');
    147                 st['throws'](toPrimitive.bind(null, uncoercibleFnObject, String), TypeError, 'uncoercibleFnObject with hint String throws a TypeError');
     134                st['throws'](toPrimitive.bind(null, v.uncoercibleFnObject), TypeError, 'uncoercibleFnObject throws a TypeError');
     135                st['throws'](toPrimitive.bind(null, v.uncoercibleFnObject, Number), TypeError, 'uncoercibleFnObject with hint Number throws a TypeError');
     136                st['throws'](toPrimitive.bind(null, v.uncoercibleFnObject, String), TypeError, 'uncoercibleFnObject with hint String throws a TypeError');
    148137                st.end();
    149138        });
Note: See TracChangeset for help on using the changeset viewer.