Projects
Mega:23.09
nodejs-es-to-primitive
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 3
View file
_service:tar_scm:nodejs-es-to-primitive.spec
Changed
@@ -1,7 +1,7 @@ %{?nodejs_find_provides_and_requires} Name: nodejs-es-to-primitive -Version: 1.2.0 -Release: 3 +Version: 1.2.1 +Release: 1 Summary: ECMAScript “ToPrimitive” algorithm License: MIT URL: https://github.com/ljharb/es-to-primitive @@ -41,6 +41,9 @@ %{nodejs_sitelib}/es-to-primitive %changelog +* Mon Nov 13 2023 xu_ping <707078654@qq.com> - 1.2.1-1 +- Upgrade version to 1.2.1 + * Fri Feb 10 2023 wangkai <wangkai385@h-partners.com> - 1.2.0-3 - remove unuse options
View file
_service:tar_scm:nodejs-es-to-primitive-fpn.patch
Changed
@@ -4,6 +4,7 @@ Patch out use of function.prototype.name + diff --git a/test/es2015.js b/test/es2015.js index 80f4083..c172e99 100644 --- a/test/es2015.js @@ -26,15 +27,16 @@ t.end(); }); diff --git a/test/es5.js b/test/es5.js -index 8b80ff5..a5352cf 100644 +index 79444b0..b9fd080 100644 --- a/test/es5.js +++ b/test/es5.js -@@ -4,12 +4,11 @@ var test = require('tape'); +@@ -4,13 +4,12 @@ var test = require('tape'); var toPrimitive = require('../es5'); var is = require('object-is'); var forEach = require('foreach'); -var functionName = require('function.prototype.name'); var debug = require('object-inspect'); + var hasSymbols = require('has-symbols')(); test('function properties', function (t) { t.equal(toPrimitive.length, 1, 'length is 1'); @@ -44,7 +46,7 @@ t.end(); }); diff --git a/test/es6.js b/test/es6.js -index c6df63f..21bfecc 100644 +index 16ea0e8..02f82ae 100644 --- a/test/es6.js +++ b/test/es6.js @@ -4,7 +4,6 @@ var test = require('tape'); @@ -54,7 +56,7 @@ -var functionName = require('function.prototype.name'); var debug = require('object-inspect'); - var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol'; + var hasSymbols = require('has-symbols')(); @@ -12,7 +11,7 @@ var hasSymbolToPrimitive = hasSymbols && typeof Symbol.toPrimitive === 'symbol'; test('function properties', function (t) {
View file
_service
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="url">git@gitee.com:src-openeuler/nodejs-es-to-primitive.git</param> <param name="scm">git</param> - <param name="revision">openEuler-23.09</param> + <param name="revision">master</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
View file
_service:tar_scm:es-to-primitive-1.2.0.tgz/.editorconfig
Deleted
@@ -1,20 +0,0 @@ -root = true - -* -indent_style = tab -indent_size = 4 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true -max_line_length = 150 - -CHANGELOG.md -indent_style = space -indent_size = 2 - -*.json -max_line_length = off - -Makefile -max_line_length = off
View file
_service:tar_scm:es-to-primitive-1.2.0.tgz/.jscs.json
Deleted
@@ -1,176 +0,0 @@ -{ - "es3": true, - - "additionalRules": , - - "requireSemicolons": true, - - "disallowMultipleSpaces": true, - - "disallowIdentifierNames": , - - "requireCurlyBraces": { - "allExcept": , - "keywords": "if", "else", "for", "while", "do", "try", "catch" - }, - - "requireSpaceAfterKeywords": "if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function", - - "disallowSpaceAfterKeywords": , - - "disallowSpaceBeforeComma": true, - "disallowSpaceAfterComma": false, - "disallowSpaceBeforeSemicolon": true, - - "disallowNodeTypes": - "DebuggerStatement", - "ForInStatement", - "LabeledStatement", - "SwitchCase", - "SwitchStatement", - "WithStatement" - , - - "requireObjectKeysOnNewLine": { "allExcept": "sameLine" }, - - "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, - "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, - "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, - - "requireSpaceBetweenArguments": true, - - "disallowSpacesInsideParentheses": true, - - "disallowSpacesInsideArrayBrackets": true, - - "disallowQuotedKeysInObjects": { "allExcept": "reserved" }, - - "disallowSpaceAfterObjectKeys": true, - - "requireCommaBeforeLineBreak": true, - - "disallowSpaceAfterPrefixUnaryOperators": "++", "--", "+", "-", "~", "!", - "requireSpaceAfterPrefixUnaryOperators": , - - "disallowSpaceBeforePostfixUnaryOperators": "++", "--", - "requireSpaceBeforePostfixUnaryOperators": , - - "disallowSpaceBeforeBinaryOperators": , - "requireSpaceBeforeBinaryOperators": "+", "-", "/", "*", "=", "==", "===", "!=", "!==", - - "requireSpaceAfterBinaryOperators": "+", "-", "/", "*", "=", "==", "===", "!=", "!==", - "disallowSpaceAfterBinaryOperators": , - - "disallowImplicitTypeConversion": "binary", "string", - - "disallowKeywords": "with", "eval", - - "requireKeywordsOnNewLine": , - "disallowKeywordsOnNewLine": "else", - - "requireLineFeedAtFileEnd": true, - - "disallowTrailingWhitespace": true, - - "disallowTrailingComma": true, - - "excludeFiles": "node_modules/**", "vendor/**", - - "disallowMultipleLineStrings": true, - - "requireDotNotation": { "allExcept": "keywords" }, - - "requireParenthesesAroundIIFE": true, - - "validateLineBreaks": "LF", - - "validateQuoteMarks": { - "escape": true, - "mark": "'" - }, - - "disallowOperatorBeforeLineBreak": , - - "requireSpaceBeforeKeywords": - "do", - "for", - "if", - "else", - "switch", - "case", - "try", - "catch", - "finally", - "while", - "with", - "return" - , - - "validateAlignedFunctionParameters": { - "lineBreakAfterOpeningBraces": true, - "lineBreakBeforeClosingBraces": true - }, - - "requirePaddingNewLinesBeforeExport": true, - - "validateNewlineAfterArrayElements": { - "maximum": 12 - }, - - "requirePaddingNewLinesAfterUseStrict": true, - - "disallowArrowFunctions": true, - - "disallowMultiLineTernary": true, - - "validateOrderInObjectKeys": false, - - "disallowIdenticalDestructuringNames": true, - - "disallowNestedTernaries": { "maxLevel": 1 }, - - "requireSpaceAfterComma": { "allExcept": "trailing" }, - "requireAlignedMultilineParams": false, - - "requireSpacesInGenerator": { - "afterStar": true - }, - - "disallowSpacesInGenerator": { - "beforeStar": true - }, - - "disallowVar": false, - - "requireArrayDestructuring": false, - - "requireEnhancedObjectLiterals": false, - - "requireObjectDestructuring": false, - - "requireEarlyReturn": false, - - "requireCapitalizedConstructorsNew": { - "allExcept": "Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array", "GetMethod" - }, - - "requireImportAlphabetized": false, - - "requireSpaceBeforeObjectValues": true, - "requireSpaceBeforeDestructuredValues": true, - - "disallowSpacesInsideTemplateStringPlaceholders": true, - - "disallowArrayDestructuringReturn": false, - - "requireNewlineBeforeSingleStatementsInIf": false, - - "disallowUnusedVariables": true, - - "requireSpacesInsideImportedObjectBraces": true, - - "requireUseStrict": true -} -
View file
_service:tar_scm:es-to-primitive-1.2.0.tgz/test/.eslintrc
Deleted
@@ -1,9 +0,0 @@ -{ - "rules": { - "array-bracket-newline": 0, - "array-element-newline": 0, - "max-statements-per-line": 2, { "max": 3 }, - "no-magic-numbers": 0, - "sort-keys": 0 - } -}
View file
_service:tar_scm:es-to-primitive-1.2.0.tgz/.eslintrc -> _service:tar_scm:es-to-primitive-1.2.1.tgz/.eslintrc
Changed
@@ -7,8 +7,16 @@ "complexity": 2, 14, "func-name-matching": 0, "id-length": 2, { "min": 1, "max": 24, "properties": "never" }, - "max-lines-per-function": 2, { "max": 68 }, "max-statements": 2, 20, "new-cap": 2, { "capIsNewExceptions": "GetMethod" } - } + }, + + "overrides": + { + "files": "test/**", + "rules": { + "max-lines-per-function": 2, { "max": 68 }, + }, + } + , }
View file
_service:tar_scm:es-to-primitive-1.2.1.tgz/.github/FUNDING.yml
Added
@@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: ljharb +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/es-to-primitive +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., 'link1', 'link2'
View file
_service:tar_scm:es-to-primitive-1.2.0.tgz/.travis.yml -> _service:tar_scm:es-to-primitive-1.2.1.tgz/.travis.yml
Changed
@@ -1,243 +1,15 @@ +version: ~> 1.0 language: node_js cache: directories: - "$(nvm cache dir)" os: - linux -node_js: - - "10.11" - - "9.11" - - "8.12" - - "7.10" - - "6.14" - - "5.12" - - "4.9" - - "iojs-v3.3" - - "iojs-v2.5" - - "iojs-v1.8" - - "0.12" - - "0.11" - - "0.10" - - "0.8" - - "0.6" -before_install: - - 'case "${TRAVIS_NODE_VERSION}" in 0.*) export NPM_CONFIG_STRICT_SSL=false ;; esac' - - 'nvm install-latest-npm' -install: - - 'if "${TRAVIS_NODE_VERSION}" = "0.6" || "${TRAVIS_NODE_VERSION}" = "0.9" ; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' -script: - - 'if -n "${PRETEST-}" ; then npm run pretest ; fi' - - 'if -n "${POSTTEST-}" ; then npm run posttest ; fi' - - 'if -n "${COVERAGE-}" ; then npm run coverage ; fi' - - 'if -n "${TEST-}" ; then npm run tests-only ; fi' -sudo: false -env: - - TEST=true +import: + - ljharb/travis-ci:node/all.yml + - ljharb/travis-ci:node/pretest.yml + - ljharb/travis-ci:node/posttest.yml + - ljharb/travis-ci:node/coverage.yml matrix: - fast_finish: true - include: - - node_js: "lts/*" - env: PRETEST=true - - node_js: "lts/*" - env: POSTTEST=true - - node_js: "4" - env: COVERAGE=true - - node_js: "10.10" - env: TEST=true ALLOW_FAILURE=true - - node_js: "10.9" - env: TEST=true ALLOW_FAILURE=true - - node_js: "10.8" - env: TEST=true ALLOW_FAILURE=true - - node_js: "10.7" - env: TEST=true ALLOW_FAILURE=true - - node_js: "10.6" - env: TEST=true ALLOW_FAILURE=true - - node_js: "10.5" - env: TEST=true ALLOW_FAILURE=true - - node_js: "10.4" - env: TEST=true ALLOW_FAILURE=true - - node_js: "10.3" - env: TEST=true ALLOW_FAILURE=true - - node_js: "10.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "10.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "10.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "9.10" - env: TEST=true ALLOW_FAILURE=true - - node_js: "9.9" - env: TEST=true ALLOW_FAILURE=true - - node_js: "9.8" - env: TEST=true ALLOW_FAILURE=true - - node_js: "9.7" - env: TEST=true ALLOW_FAILURE=true - - node_js: "9.6" - env: TEST=true ALLOW_FAILURE=true - - node_js: "9.5" - env: TEST=true ALLOW_FAILURE=true - - node_js: "9.4" - env: TEST=true ALLOW_FAILURE=true - - node_js: "9.3" - env: TEST=true ALLOW_FAILURE=true - - node_js: "9.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "9.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "9.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "8.11" - env: TEST=true ALLOW_FAILURE=true - - node_js: "8.10" - env: TEST=true ALLOW_FAILURE=true - - node_js: "8.9" - env: TEST=true ALLOW_FAILURE=true - - node_js: "8.8" - env: TEST=true ALLOW_FAILURE=true - - node_js: "8.7" - env: TEST=true ALLOW_FAILURE=true - - node_js: "8.6" - env: TEST=true ALLOW_FAILURE=true - - node_js: "8.5" - env: TEST=true ALLOW_FAILURE=true - - node_js: "8.4" - env: TEST=true ALLOW_FAILURE=true - - node_js: "8.3" - env: TEST=true ALLOW_FAILURE=true - - node_js: "8.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "8.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "8.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.9" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.8" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.7" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.6" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.5" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.4" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.3" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.13" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.12" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.11" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.10" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.9" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.8" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.7" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.6" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.5" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.4" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.3" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.11" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.10" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.9" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.8" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.7" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.6" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.5" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.4" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.3" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.8" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.7" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.6" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.5" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.4" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.3" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v3.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v3.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v3.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v2.4" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v2.3" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v2.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v2.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v2.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v1.7" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v1.6" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v1.5" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v1.4" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v1.3" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v1.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v1.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v1.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "0.9" - env: TEST=true ALLOW_FAILURE=true - - node_js: "0.4" - env: TEST=true ALLOW_FAILURE=true allow_failures: - - os: osx - - env: TEST=true ALLOW_FAILURE=true - env: COVERAGE=true - - node_js: "0.6"
View file
_service:tar_scm:es-to-primitive-1.2.0.tgz/CHANGELOG.md -> _service:tar_scm:es-to-primitive-1.2.1.tgz/CHANGELOG.md
Changed
@@ -1,3 +1,14 @@ +1.2.1 / 2019-11-08 +================= + * readme remove testling URLs + * meta add `funding` field + * meta create FUNDING.yml + * Dev Deps update `eslint`, `@ljharb/eslint-config`, `covert`, `replace`, `semver`, `tape`, `function.prototype.name` + * Tests use shared travis-ci configs + * Tests Add es5 tests for `symbol` types (#45) + * Tests use `npx aud` instead of `nsp` or `npm audit` with hoops + * Tests remove `jscs` + 1.2.0 / 2018-09-27 ================= * New create ES2015 entry point/property, to replace ES6
View file
_service:tar_scm:es-to-primitive-1.2.0.tgz/README.md -> _service:tar_scm:es-to-primitive-1.2.1.tgz/README.md
Changed
@@ -42,8 +42,6 @@ deps-url: https://david-dm.org/ljharb/es-to-primitive dev-deps-svg: https://david-dm.org/ljharb/es-to-primitive/dev-status.svg dev-deps-url: https://david-dm.org/ljharb/es-to-primitive#info=devDependencies -testling-svg: https://ci.testling.com/ljharb/es-to-primitive.png -testling-url: https://ci.testling.com/ljharb/es-to-primitive npm-badge-png: https://nodei.co/npm/es-to-primitive.png?downloads=true&stars=true license-image: http://img.shields.io/npm/l/es-to-primitive.svg license-url: LICENSE
View file
_service:tar_scm:es-to-primitive-1.2.0.tgz/helpers/isPrimitive.js -> _service:tar_scm:es-to-primitive-1.2.1.tgz/helpers/isPrimitive.js
Changed
@@ -1,3 +1,5 @@ +'use strict'; + module.exports = function isPrimitive(value) { return value === null || (typeof value !== 'function' && typeof value !== 'object'); };
View file
_service:tar_scm:es-to-primitive-1.2.0.tgz/package.json -> _service:tar_scm:es-to-primitive-1.2.1.tgz/package.json
Changed
@@ -1,21 +1,21 @@ { "name": "es-to-primitive", - "version": "1.2.0", - "author": "Jordan Harband", + "version": "1.2.1", + "author": "Jordan Harband <ljharb@gmail.com>", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, "description": "ECMAScript “ToPrimitive” algorithm. Provides ES5 and ES2015 versions.", "license": "MIT", "main": "index.js", "scripts": { "pretest": "npm run --silent lint", "test": "npm run --silent tests-only", - "posttest": "npm run --silent security", + "posttest": "npx aud", "tests-only": "node --es-staging test", "coverage": "covert test/*.js", "coverage-quiet": "covert test/*.js --quiet", - "lint": "npm run --silent jscs && npm run --silent eslint", - "jscs": "jscs test/*.js *.js", - "eslint": "eslint test/*.js *.js", - "security": "nsp check" + "lint": "eslint ." }, "repository": { "type": "git", @@ -45,18 +45,17 @@ "is-symbol": "^1.0.2" }, "devDependencies": { - "@ljharb/eslint-config": "^13.0.0", - "covert": "^1.1.0", - "eslint": "^5.6.0", + "@ljharb/eslint-config": "^15.0.0", + "covert": "^1.1.1", + "eslint": "^6.6.0", "foreach": "^2.0.5", - "function.prototype.name": "^1.1.0", - "jscs": "^3.0.7", - "nsp": "^3.2.1", + "function.prototype.name": "^1.1.1", + "has-symbols": "^1.0.0", "object-inspect": "^1.6.0", "object-is": "^1.0.1", - "replace": "^1.0.0", - "semver": "^5.5.1", - "tape": "^4.9.1" + "replace": "^1.1.1", + "semver": "^6.3.0", + "tape": "^4.11.0" }, "testling": { "files": "test",
View file
_service:tar_scm:es-to-primitive-1.2.0.tgz/test/es5.js -> _service:tar_scm:es-to-primitive-1.2.1.tgz/test/es5.js
Changed
@@ -6,6 +6,7 @@ var forEach = require('foreach'); var functionName = require('function.prototype.name'); var debug = require('object-inspect'); +var hasSymbols = require('has-symbols')(); test('function properties', function (t) { t.equal(toPrimitive.length, 1, 'length is 1'); @@ -25,6 +26,29 @@ t.end(); }); +test('Symbols', { skip: !hasSymbols }, function (t) { + var symbols = + Symbol('foo'), + Symbol.iterator, + Symbol'for'('foo') // eslint-disable-line no-restricted-properties + ; + forEach(symbols, function (sym) { + t.equal(toPrimitive(sym), sym, 'toPrimitive(' + debug(sym) + ') returns the same value'); + t.equal(toPrimitive(sym, String), sym, 'toPrimitive(' + debug(sym) + ', String) returns the same value'); + t.equal(toPrimitive(sym, Number), sym, 'toPrimitive(' + debug(sym) + ', Number) returns the same value'); + }); + + var primitiveSym = Symbol('primitiveSym'); + var stringSym = Symbol.prototype.toString.call(primitiveSym); + var objectSym = Object(primitiveSym); + t.equal(toPrimitive(objectSym), primitiveSym, 'toPrimitive(' + debug(objectSym) + ') returns ' + debug(primitiveSym)); + + // This is different from ES2015, as the ES5 algorithm doesn't account for the existence of Symbols: + t.equal(toPrimitive(objectSym, String), stringSym, 'toPrimitive(' + debug(objectSym) + ', String) returns ' + debug(stringSym)); + t.equal(toPrimitive(objectSym, Number), primitiveSym, 'toPrimitive(' + debug(objectSym) + ', Number) returns ' + debug(primitiveSym)); + t.end(); +}); + test('Arrays', function (t) { var arrays = , 'a', 'b', 1, 2; forEach(arrays, function (arr) {
View file
_service:tar_scm:es-to-primitive-1.2.0.tgz/test/es6.js -> _service:tar_scm:es-to-primitive-1.2.1.tgz/test/es6.js
Changed
@@ -7,7 +7,7 @@ var functionName = require('function.prototype.name'); var debug = require('object-inspect'); -var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol'; +var hasSymbols = require('has-symbols')(); var hasSymbolToPrimitive = hasSymbols && typeof Symbol.toPrimitive === 'symbol'; test('function properties', function (t) {
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2