mirror of
https://github.com/musix-org/musix-oss
synced 2025-06-17 01:16:00 +00:00
Modules
This commit is contained in:
11
node_modules/has-symbols/.eslintrc
generated
vendored
Normal file
11
node_modules/has-symbols/.eslintrc
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"max-statements-per-line": [2, { "max": 2 }],
|
||||
"no-magic-numbers": 0,
|
||||
"multiline-comment-style": 0,
|
||||
}
|
||||
}
|
12
node_modules/has-symbols/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/has-symbols/.github/FUNDING.yml
generated
vendored
Normal file
@ -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/has-symbols
|
||||
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']
|
15
node_modules/has-symbols/.github/workflows/rebase.yml
generated
vendored
Normal file
15
node_modules/has-symbols/.github/workflows/rebase.yml
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
name: Automatic Rebase
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
_:
|
||||
name: "Automatic Rebase"
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: ljharb/rebase@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
12
node_modules/has-symbols/.travis.yml
generated
vendored
Normal file
12
node_modules/has-symbols/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
version: ~> 1.0
|
||||
language: node_js
|
||||
os:
|
||||
- linux
|
||||
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:
|
||||
allow_failures:
|
||||
- env: COVERAGE=true
|
34
node_modules/has-symbols/CHANGELOG.md
generated
vendored
Normal file
34
node_modules/has-symbols/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||
|
||||
## [v1.0.1](https://github.com/inspect-js/has-symbols/compare/v1.0.0...v1.0.1) - 2019-11-17
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] use shared travis-ci configs [`ce396c9`](https://github.com/inspect-js/has-symbols/commit/ce396c9419ff11c43d0da5d05cdbb79f7fb42229)
|
||||
- [Tests] up to `node` `v12.4`, `v11.15`, `v10.15`, `v9.11`, `v8.15`, `v7.10`, `v6.17`, `v4.9`; use `nvm install-latest-npm` [`0690732`](https://github.com/inspect-js/has-symbols/commit/0690732801f47ab429f39ba1962f522d5c462d6b)
|
||||
- [meta] add `auto-changelog` [`2163d0b`](https://github.com/inspect-js/has-symbols/commit/2163d0b7f36343076b8f947cd1667dd1750f26fc)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `core-js`, `safe-publish-latest`, `tape` [`8e0951f`](https://github.com/inspect-js/has-symbols/commit/8e0951f1a7a2e52068222b7bb73511761e6e4d9c)
|
||||
- [actions] add automatic rebasing / merge commit blocking [`b09cdb7`](https://github.com/inspect-js/has-symbols/commit/b09cdb7cd7ee39e7a769878f56e2d6066f5ccd1d)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `core-js`, `get-own-property-symbols`, `tape` [`1dd42cd`](https://github.com/inspect-js/has-symbols/commit/1dd42cd86183ed0c50f99b1062345c458babca91)
|
||||
- [meta] create FUNDING.yml [`aa57a17`](https://github.com/inspect-js/has-symbols/commit/aa57a17b19708906d1927f821ea8e73394d84ca4)
|
||||
- Only apps should have lockfiles [`a2d8bea`](https://github.com/inspect-js/has-symbols/commit/a2d8bea23a97d15c09eaf60f5b107fcf9a4d57aa)
|
||||
- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`9e96cb7`](https://github.com/inspect-js/has-symbols/commit/9e96cb783746cbed0c10ef78e599a8eaa7ebe193)
|
||||
- [meta] add `funding` field [`a0b32cf`](https://github.com/inspect-js/has-symbols/commit/a0b32cf68e803f963c1639b6d47b0a9d6440bab0)
|
||||
- [Dev Deps] update `safe-publish-latest` [`cb9f0a5`](https://github.com/inspect-js/has-symbols/commit/cb9f0a521a3a1790f1064d437edd33bb6c3d6af0)
|
||||
|
||||
## v1.0.0 - 2016-09-19
|
||||
|
||||
### Commits
|
||||
|
||||
- Tests. [`ecb6eb9`](https://github.com/inspect-js/has-symbols/commit/ecb6eb934e4883137f3f93b965ba5e0a98df430d)
|
||||
- package.json [`88a337c`](https://github.com/inspect-js/has-symbols/commit/88a337cee0864a0da35f5d19e69ff0ef0150e46a)
|
||||
- Initial commit [`42e1e55`](https://github.com/inspect-js/has-symbols/commit/42e1e5502536a2b8ac529c9443984acd14836b1c)
|
||||
- Initial implementation. [`33f5cc6`](https://github.com/inspect-js/has-symbols/commit/33f5cc6cdff86e2194b081ee842bfdc63caf43fb)
|
||||
- read me [`01f1170`](https://github.com/inspect-js/has-symbols/commit/01f1170188ff7cb1558aa297f6ba5b516c6d7b0c)
|
21
node_modules/has-symbols/LICENSE
generated
vendored
Normal file
21
node_modules/has-symbols/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016 Jordan Harband
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
45
node_modules/has-symbols/README.md
generated
vendored
Normal file
45
node_modules/has-symbols/README.md
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
# has-symbols <sup>[![Version Badge][2]][1]</sup>
|
||||
|
||||
[![Build Status][3]][4]
|
||||
[![dependency status][5]][6]
|
||||
[![dev dependency status][7]][8]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][11]][1]
|
||||
|
||||
Determine if the JS environment has Symbol support. Supports spec, or shams.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var hasSymbols = require('has-symbols');
|
||||
|
||||
hasSymbols() === true; // if the environment has native Symbol support. Not polyfillable, not forgeable.
|
||||
|
||||
var hasSymbolsKinda = require('has-symbols/shams');
|
||||
hasSymbolsKinda() === true; // if the environment has a Symbol sham that mostly follows the spec.
|
||||
```
|
||||
|
||||
## Supported Symbol shams
|
||||
- get-own-property-symbols [npm](https://www.npmjs.com/package/get-own-property-symbols) | [github](https://github.com/WebReflection/get-own-property-symbols)
|
||||
- core-js [npm](https://www.npmjs.com/package/core-js) | [github](https://github.com/zloirock/core-js)
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[1]: https://npmjs.org/package/has-symbols
|
||||
[2]: http://versionbadg.es/ljharb/has-symbols.svg
|
||||
[3]: https://travis-ci.org/ljharb/has-symbols.svg
|
||||
[4]: https://travis-ci.org/ljharb/has-symbols
|
||||
[5]: https://david-dm.org/ljharb/has-symbols.svg
|
||||
[6]: https://david-dm.org/ljharb/has-symbols
|
||||
[7]: https://david-dm.org/ljharb/has-symbols/dev-status.svg
|
||||
[8]: https://david-dm.org/ljharb/has-symbols#info=devDependencies
|
||||
[9]: https://ci.testling.com/ljharb/has-symbols.png
|
||||
[10]: https://ci.testling.com/ljharb/has-symbols
|
||||
[11]: https://nodei.co/npm/has-symbols.png?downloads=true&stars=true
|
||||
[license-image]: http://img.shields.io/npm/l/has-symbols.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: http://img.shields.io/npm/dm/has-symbols.svg
|
||||
[downloads-url]: http://npm-stat.com/charts.html?package=has-symbols
|
13
node_modules/has-symbols/index.js
generated
vendored
Normal file
13
node_modules/has-symbols/index.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var origSymbol = global.Symbol;
|
||||
var hasSymbolSham = require('./shams');
|
||||
|
||||
module.exports = function hasNativeSymbols() {
|
||||
if (typeof origSymbol !== 'function') { return false; }
|
||||
if (typeof Symbol !== 'function') { return false; }
|
||||
if (typeof origSymbol('foo') !== 'symbol') { return false; }
|
||||
if (typeof Symbol('bar') !== 'symbol') { return false; }
|
||||
|
||||
return hasSymbolSham();
|
||||
};
|
121
node_modules/has-symbols/package.json
generated
vendored
Normal file
121
node_modules/has-symbols/package.json
generated
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
{
|
||||
"_from": "has-symbols@^1.0.1",
|
||||
"_id": "has-symbols@1.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==",
|
||||
"_location": "/has-symbols",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "has-symbols@^1.0.1",
|
||||
"name": "has-symbols",
|
||||
"escapedName": "has-symbols",
|
||||
"rawSpec": "^1.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/es-abstract",
|
||||
"/es-get-iterator",
|
||||
"/is-symbol",
|
||||
"/object.assign"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
|
||||
"_shasum": "9f5214758a44196c406d9bd76cebf81ec2dd31e8",
|
||||
"_spec": "has-symbols@^1.0.1",
|
||||
"_where": "C:\\Users\\matia\\Documents\\GitHub\\Musix\\node_modules\\es-abstract",
|
||||
"author": {
|
||||
"name": "Jordan Harband",
|
||||
"email": "ljharb@gmail.com",
|
||||
"url": "http://ljharb.codes"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ljharb/has-symbols/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jordan Harband",
|
||||
"email": "ljharb@gmail.com",
|
||||
"url": "http://ljharb.codes"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Determine if the JS environment has Symbol support. Supports spec, or shams.",
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^15.0.1",
|
||||
"auto-changelog": "^1.16.2",
|
||||
"core-js": "^2.6.10",
|
||||
"eslint": "^6.6.0",
|
||||
"get-own-property-symbols": "^0.9.4",
|
||||
"safe-publish-latest": "^1.1.4",
|
||||
"tape": "^4.11.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"homepage": "https://github.com/ljharb/has-symbols#readme",
|
||||
"keywords": [
|
||||
"Symbol",
|
||||
"symbols",
|
||||
"typeof",
|
||||
"sham",
|
||||
"polyfill",
|
||||
"native",
|
||||
"core-js",
|
||||
"ES6"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "has-symbols",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/ljharb/has-symbols.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint *.js",
|
||||
"posttest": "npx aud",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"",
|
||||
"prepublish": "safe-publish-latest",
|
||||
"pretest": "npm run --silent lint",
|
||||
"test": "npm run --silent tests-only",
|
||||
"test:shams": "npm run --silent test:shams:getownpropertysymbols && npm run --silent test:shams:corejs",
|
||||
"test:shams:corejs": "node test/shams/core-js.js",
|
||||
"test:shams:getownpropertysymbols": "node test/shams/get-own-property-symbols.js",
|
||||
"test:staging": "node --harmony --es-staging test",
|
||||
"test:stock": "node test",
|
||||
"tests-only": "npm run --silent test:stock && npm run --silent test:staging && npm run --silent test:shams",
|
||||
"version": "auto-changelog && git add CHANGELOG.md"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js",
|
||||
"browsers": [
|
||||
"iexplore/6.0..latest",
|
||||
"firefox/3.0..6.0",
|
||||
"firefox/15.0..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/4.0..10.0",
|
||||
"chrome/20.0..latest",
|
||||
"chrome/canary",
|
||||
"opera/10.0..latest",
|
||||
"opera/next",
|
||||
"safari/4.0..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2"
|
||||
]
|
||||
},
|
||||
"version": "1.0.1"
|
||||
}
|
42
node_modules/has-symbols/shams.js
generated
vendored
Normal file
42
node_modules/has-symbols/shams.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
|
||||
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
||||
module.exports = function hasSymbols() {
|
||||
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
||||
if (typeof Symbol.iterator === 'symbol') { return true; }
|
||||
|
||||
var obj = {};
|
||||
var sym = Symbol('test');
|
||||
var symObj = Object(sym);
|
||||
if (typeof sym === 'string') { return false; }
|
||||
|
||||
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
||||
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
||||
|
||||
// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
||||
// if (sym instanceof Symbol) { return false; }
|
||||
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
||||
// if (!(symObj instanceof Symbol)) { return false; }
|
||||
|
||||
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
||||
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
||||
|
||||
var symVal = 42;
|
||||
obj[sym] = symVal;
|
||||
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax
|
||||
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
||||
|
||||
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
||||
|
||||
var syms = Object.getOwnPropertySymbols(obj);
|
||||
if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
||||
|
||||
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
||||
|
||||
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
||||
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
||||
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
22
node_modules/has-symbols/test/index.js
generated
vendored
Normal file
22
node_modules/has-symbols/test/index.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var hasSymbols = require('../');
|
||||
var runSymbolTests = require('./tests');
|
||||
|
||||
test('interface', function (t) {
|
||||
t.equal(typeof hasSymbols, 'function', 'is a function');
|
||||
t.equal(typeof hasSymbols(), 'boolean', 'returns a boolean');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Symbols are supported', { skip: !hasSymbols() }, function (t) {
|
||||
runSymbolTests(t);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Symbols are not supported', { skip: hasSymbols() }, function (t) {
|
||||
t.equal(typeof Symbol, 'undefined', 'global Symbol is undefined');
|
||||
t.equal(typeof Object.getOwnPropertySymbols, 'undefined', 'Object.getOwnPropertySymbols does not exist');
|
||||
t.end();
|
||||
});
|
28
node_modules/has-symbols/test/shams/core-js.js
generated
vendored
Normal file
28
node_modules/has-symbols/test/shams/core-js.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
|
||||
if (typeof Symbol === 'function' && typeof Symbol() === 'symbol') {
|
||||
test('has native Symbol support', function (t) {
|
||||
t.equal(typeof Symbol, 'function');
|
||||
t.equal(typeof Symbol(), 'symbol');
|
||||
t.end();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
var hasSymbols = require('../../shams');
|
||||
|
||||
test('polyfilled Symbols', function (t) {
|
||||
/* eslint-disable global-require */
|
||||
t.equal(hasSymbols(), false, 'hasSymbols is false before polyfilling');
|
||||
require('core-js/fn/symbol');
|
||||
require('core-js/fn/symbol/to-string-tag');
|
||||
|
||||
require('../tests')(t);
|
||||
|
||||
var hasSymbolsAfter = hasSymbols();
|
||||
t.equal(hasSymbolsAfter, true, 'hasSymbols is true after polyfilling');
|
||||
/* eslint-enable global-require */
|
||||
t.end();
|
||||
});
|
28
node_modules/has-symbols/test/shams/get-own-property-symbols.js
generated
vendored
Normal file
28
node_modules/has-symbols/test/shams/get-own-property-symbols.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
|
||||
if (typeof Symbol === 'function' && typeof Symbol() === 'symbol') {
|
||||
test('has native Symbol support', function (t) {
|
||||
t.equal(typeof Symbol, 'function');
|
||||
t.equal(typeof Symbol(), 'symbol');
|
||||
t.end();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
var hasSymbols = require('../../shams');
|
||||
|
||||
test('polyfilled Symbols', function (t) {
|
||||
/* eslint-disable global-require */
|
||||
t.equal(hasSymbols(), false, 'hasSymbols is false before polyfilling');
|
||||
|
||||
require('get-own-property-symbols');
|
||||
|
||||
require('../tests')(t);
|
||||
|
||||
var hasSymbolsAfter = hasSymbols();
|
||||
t.equal(hasSymbolsAfter, true, 'hasSymbols is true after polyfilling');
|
||||
/* eslint-enable global-require */
|
||||
t.end();
|
||||
});
|
54
node_modules/has-symbols/test/tests.js
generated
vendored
Normal file
54
node_modules/has-symbols/test/tests.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function runSymbolTests(t) {
|
||||
t.equal(typeof Symbol, 'function', 'global Symbol is a function');
|
||||
|
||||
if (typeof Symbol !== 'function') { return false };
|
||||
|
||||
t.notEqual(Symbol(), Symbol(), 'two symbols are not equal');
|
||||
|
||||
/*
|
||||
t.equal(
|
||||
Symbol.prototype.toString.call(Symbol('foo')),
|
||||
Symbol.prototype.toString.call(Symbol('foo')),
|
||||
'two symbols with the same description stringify the same'
|
||||
);
|
||||
*/
|
||||
|
||||
var foo = Symbol('foo');
|
||||
|
||||
/*
|
||||
t.notEqual(
|
||||
String(foo),
|
||||
String(Symbol('bar')),
|
||||
'two symbols with different descriptions do not stringify the same'
|
||||
);
|
||||
*/
|
||||
|
||||
t.equal(typeof Symbol.prototype.toString, 'function', 'Symbol#toString is a function');
|
||||
// t.equal(String(foo), Symbol.prototype.toString.call(foo), 'Symbol#toString equals String of the same symbol');
|
||||
|
||||
t.equal(typeof Object.getOwnPropertySymbols, 'function', 'Object.getOwnPropertySymbols is a function');
|
||||
|
||||
var obj = {};
|
||||
var sym = Symbol('test');
|
||||
var symObj = Object(sym);
|
||||
t.notEqual(typeof sym, 'string', 'Symbol is not a string');
|
||||
t.equal(Object.prototype.toString.call(sym), '[object Symbol]', 'symbol primitive Object#toStrings properly');
|
||||
t.equal(Object.prototype.toString.call(symObj), '[object Symbol]', 'symbol primitive Object#toStrings properly');
|
||||
|
||||
var symVal = 42;
|
||||
obj[sym] = symVal;
|
||||
for (sym in obj) { t.fail('symbol property key was found in for..in of object'); }
|
||||
|
||||
t.deepEqual(Object.keys(obj), [], 'no enumerable own keys on symbol-valued object');
|
||||
t.deepEqual(Object.getOwnPropertyNames(obj), [], 'no own names on symbol-valued object');
|
||||
t.deepEqual(Object.getOwnPropertySymbols(obj), [sym], 'one own symbol on symbol-valued object');
|
||||
t.equal(Object.prototype.propertyIsEnumerable.call(obj, sym), true, 'symbol is enumerable');
|
||||
t.deepEqual(Object.getOwnPropertyDescriptor(obj, sym), {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: 42,
|
||||
writable: true
|
||||
}, 'property descriptor is correct');
|
||||
};
|
Reference in New Issue
Block a user