Skip to content

Commit

Permalink
Don't shadow the global Symbol.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 3, 2015
1 parent 4bb89b2 commit f9bfe5e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ var exported = require('../');
var runArrayTests = function () {
'use strict';

if (typeof Symbol === 'undefined') { var Symbol = {}; }
var Sym = typeof Symbol !== 'undefined' ? Symbol : {};
var isSymbol = function (sym) {
/*jshint notypeof: true */
return typeof Symbol === 'function' && typeof sym === 'symbol';
return typeof Sym === 'function' && typeof sym === 'symbol';
/*jshint notypeof: false */
};

Expand All @@ -23,8 +23,8 @@ var runArrayTests = function () {
it('uses Symbol.iterator if available', function () {
var a = [];
var iterator;
if (isSymbol(Symbol && Symbol.iterator)) {
iterator = Symbol.iterator;
if (isSymbol(Sym.iterator)) {
iterator = Sym.iterator;
} else {
return;
}
Expand Down Expand Up @@ -483,8 +483,8 @@ var runArrayTests = function () {
});

it('should be unscopable if Symbols exist', function () {
if (isSymbol(Symbol && Symbol.unscopables)) {
var unscopables = mylist[Symbol.unscopables];
if (isSymbol(Sym.unscopables)) {
var unscopables = mylist[Sym.unscopables];
expect(!!unscopables).to.equal(true);
expect(unscopables.keys).to.equal(true);
}
Expand Down Expand Up @@ -540,8 +540,8 @@ var runArrayTests = function () {
});

it('should be unscopable if Symbols exist', function () {
if (isSymbol(Symbol && Symbol.unscopables)) {
var unscopables = mylist[Symbol.unscopables];
if (isSymbol(Sym.unscopables)) {
var unscopables = mylist[Sym.unscopables];
expect(!!unscopables).to.equal(true);
expect(unscopables.values).to.equal(true);
}
Expand Down Expand Up @@ -603,8 +603,8 @@ var runArrayTests = function () {
});

it('should be unscopable if Symbols exist', function () {
if (isSymbol(Symbol && Symbol.unscopables)) {
var unscopables = mylist[Symbol.unscopables];
if (isSymbol(Sym.unscopables)) {
var unscopables = mylist[Sym.unscopables];
expect(!!unscopables).to.equal(true);
expect(unscopables.entries).to.equal(true);
}
Expand Down

0 comments on commit f9bfe5e

Please sign in to comment.