New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

es6-shim

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6-shim - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

3

CHANGELOG.md

@@ -0,1 +1,4 @@

# es6-shim 0.5.2 (June 17, 2012)
* Removed `String#toArray` and `Object.isObject` as per spec updates.
# es6-shim 0.5.1 (June 14, 2012)

@@ -2,0 +5,0 @@ * Made Map and Set follow Spidermonkey implementation instead of V8.

8

es6-shim.js

@@ -50,6 +50,2 @@ ({define: (typeof define === 'function')

return this.indexOf(substring) !== -1;
},
toArray: function() {
return this.split('');
}

@@ -170,6 +166,2 @@ });

return !Object.is(x, y);
},
isObject: function(value) {
return typeof value === 'object' && value !== null;
}

@@ -176,0 +168,0 @@ });

@@ -5,3 +5,3 @@ {

"description": "ECMAScript 6 (Harmony) compatibility shims for legacy JavaScript engines",
"version": "0.5.1",
"version": "0.5.2",
"homepage": "https://github.com/paulmillr/es6-shim/",

@@ -22,4 +22,4 @@ "repository": {

"mocha": "1.1.0",
"expect.js": "0.1.2"
"chai": "1.0.4"
}
}

@@ -18,3 +18,3 @@ # ES6 Shim

* String.prototype.repeat, String.prototype.startsWith,
String.prototype.endsWith, String.prototype.contains, String.prototype.toArray
String.prototype.endsWith, String.prototype.contains
* Array.from, Array.of

@@ -24,3 +24,3 @@ * Number.MAX_INTEGER, Number.EPSILON, Number.parseInt, Number.parseFloat,

* Object.getOwnPropertyDescriptors, Object.getPropertyDescriptor,
Object.getPropertyNames, Object.is, Object.isnt, Object.isObject
Object.getPropertyNames, Object.is, Object.isnt
* Math.sign, Math.log10, Math.log2, Math.log1p, Math.expm1, Math.cosh,

@@ -51,5 +51,3 @@ Math.sinh, Math.tanh, Math.acosh, Math.asinh, Math.atanh, Math.hypot,

Object.is(NaN, NaN) // Fixes ===. 0 isnt -0, NaN is NaN
Object.isObject(null) // false. Fixes null.
'123'.repeat(2) // '123123'
'123'.toArray() // ['1', '2', '3']
'john alice'.contains('john') // true

@@ -56,0 +54,0 @@ Number.isNaN('123') // false. isNaN('123') will give true.

@@ -33,3 +33,3 @@ // Big thanks to V8 folks for test ideas.

it('should exist in global namespace', function() {
expect(Map).to.be.ok();
expect(Map).to.be.ok;
});

@@ -41,3 +41,3 @@

map[method](new Object);
}).to.not.throwException();
}).to.not.throw();
})

@@ -61,21 +61,21 @@ });

testMapping(key, 'to-be-present');
expect(map.has(key)).to.be(true);
expect(map.has(new Object)).to.be(false);
expect(map.has(key)).to.be.true;
expect(map.has(new Object)).to.be.false;
testMapping(key, void 0);
expect(map.has(key)).to.be(true);
expect(map.has(new Object)).to.be(false);
expect(map.has(key)).to.be.true;
expect(map.has(new Object)).to.be.false;
});
it('should allow to be initialized directly', function() {
expect(Map()).to.be.a(Map);
expect(Map()).to.be.an.instanceof(Map);
});
it('should allow NaN values as keys', function() {
expect(map.has(NaN)).to.be(false);
expect(map.has(NaN + 1)).to.be(false);
expect(map.has(23)).to.be(false);
expect(map.has(NaN)).to.be.false;
expect(map.has(NaN + 1)).to.be.false;
expect(map.has(23)).to.be.false;
map.set(NaN, 'value');
expect(map.has(NaN)).to.be(true);
expect(map.has(NaN + 1)).to.be(true);
expect(map.has(23)).to.be(false);
expect(map.has(NaN)).to.be.true;
expect(map.has(NaN + 1)).to.be.true;
expect(map.has(23)).to.be.false;
});

@@ -90,7 +90,7 @@

it('should allow common ecmascript idioms', function() {
expect(map).to.be.a(Map);
expect(Map.prototype.get).to.be.a(Function);
expect(Map.prototype.set).to.be.a(Function);
expect(Map.prototype.has).to.be.a(Function);
expect(Map.prototype['delete']).to.be.a(Function);
expect(map).to.be.an.instanceof(Map);
expect(Map.prototype.get).to.be.an.instanceof(Function);
expect(Map.prototype.set).to.be.an.instanceof(Function);
expect(Map.prototype.has).to.be.an.instanceof(Function);
expect(Map.prototype['delete']).to.be.an.instanceof(Function);
});

@@ -115,3 +115,3 @@

it('should exist in global namespace', function() {
expect(Set).to.be.ok();
expect(Set).to.be.ok;
});

@@ -123,3 +123,3 @@

set[method](new Object);
}).to.not.throwException();
}).to.not.throw();
})

@@ -130,7 +130,7 @@ });

var testSet = function(key) {
expect(set.has(key)).to.be(false);
expect(set.has(key)).to.be.false;
set.add(key);
expect(set.has(key)).to.be(true);
expect(set.has(key)).to.be.true;
set['delete'](key);
expect(set.has(key)).to.be(false);
expect(set.has(key)).to.be.false;
};

@@ -149,13 +149,13 @@

it('should allow to be initialized directly', function() {
expect(Set()).to.be.a(Set);
expect(Set()).to.be.an.instanceof(Set);
});
it('should allow NaN values as keys', function() {
expect(set.has(NaN)).to.be(false);
expect(set.has(NaN + 1)).to.be(false);
expect(set.has(23)).to.be(false);
expect(set.has(NaN)).to.be.false;
expect(set.has(NaN + 1)).to.be.false;
expect(set.has(23)).to.be.false;
set.add(NaN);
expect(set.has(NaN)).to.be(true);
expect(set.has(NaN + 1)).to.be(true);
expect(set.has(23)).to.be(false);
expect(set.has(NaN)).to.be.true;
expect(set.has(NaN + 1)).to.be.true;
expect(set.has(23)).to.be.false;
});

@@ -170,6 +170,6 @@

it('should allow common ecmascript idioms', function() {
expect(set).to.be.a(Set);
expect(Set.prototype.add).to.be.a(Function);
expect(Set.prototype.has).to.be.a(Function);
expect(Set.prototype['delete']).to.be.a(Function);
expect(set).to.be.an.instanceof(Set);
expect(Set.prototype.add).to.be.an.instanceof(Function);
expect(Set.prototype.has).to.be.an.instanceof(Function);
expect(Set.prototype['delete']).to.be.an.instanceof(Function);
});

@@ -176,0 +176,0 @@

@@ -86,3 +86,3 @@ var Assertion = expect().constructor;

expect(Math.sign(-0)).to.equal(-0);
expect(Number.isNaN(Math.sign(NaN))).to.be.ok();
expect(Number.isNaN(Math.sign(NaN))).to.be.ok;
});

@@ -89,0 +89,0 @@ });

@@ -7,6 +7,6 @@ describe('Number', function() {

var expectToBeOk = function(item) {
expect(item).to.be.ok();
expect(item).to.be.ok;
};
var expectToNotBeOk = function(item) {
expect(item).to.not.be.ok();
expect(item).to.not.be.ok;
};

@@ -61,3 +61,3 @@

it('should be truthy only on NaN', function() {
expect(Number.isNaN(NaN)).to.be.ok();
expect(Number.isNaN(NaN)).to.be.ok;
integers.concat(nonIntegers).map(Number.isNaN).forEach(expectToNotBeOk);

@@ -64,0 +64,0 @@ });

@@ -7,3 +7,3 @@ describe('Object', function() {

}).forEach(function(result) {
expect(result).to.be.ok();
expect(result).to.be.ok;
});

@@ -13,7 +13,7 @@ });

it('should compare 0 and -0 correctly', function() {
expect(Object.is(0, -0)).to.not.be.ok();
expect(Object.is(0, -0)).to.not.be.ok;
});
it('should compare NaNs correctly', function() {
expect(Object.is(NaN, NaN)).to.be.ok();
expect(Object.is(NaN, NaN)).to.be.ok;
});

@@ -27,3 +27,3 @@ });

}).forEach(function(result) {
expect(result).to.not.be.ok();
expect(result).to.not.be.ok;
});

@@ -33,26 +33,10 @@ });

it('should compare 0 and -0 correctly', function() {
expect(Object.isnt(0, -0)).to.be.ok();
expect(Object.isnt(0, -0)).to.be.ok;
});
it('should compare NaNs correctly', function() {
expect(Object.isnt(NaN, NaN)).to.not.be.ok();
expect(Object.isnt(NaN, NaN)).to.not.be.ok;
});
});
describe('Object.isObject()', function() {
it('should compare regular objects correctly', function() {
[{}, [], new String('h')].map(Object.isObject).forEach(function(result) {
expect(result).to.be.ok();
});
[void 0, 'hello', 5].map(Object.isObject).forEach(function(result) {
expect(result).to.not.be.ok();
});
});
it('should compare 0 and -0 correctly', function() {
expect(Object.isObject(null)).to.not.be.ok();
});
});
describe('Object.getOwnPropertyDescriptors()', function() {

@@ -59,0 +43,0 @@ it('should produce an array of properties', function() {

@@ -10,10 +10,10 @@ describe('String', function() {

it('should be truthy on correct results', function() {
expect('test'.startsWith('te')).to.be.ok();
expect('test'.startsWith('te')).to.be.ok;
});
it('should be falsy on incorrect results', function() {
expect('test'.startsWith('st')).to.not.be.ok();
expect(''.startsWith('/')).to.not.be.ok();
expect('#'.startsWith('/')).to.not.be.ok();
expect('##'.startsWith('///')).to.not.be.ok();
expect('test'.startsWith('st')).to.not.be.ok;
expect(''.startsWith('/')).to.not.be.ok;
expect('#'.startsWith('/')).to.not.be.ok;
expect('##'.startsWith('///')).to.not.be.ok;
});

@@ -24,10 +24,10 @@ });

it('should be truthy on correct results', function() {
expect('test'.endsWith('st')).to.be.ok();
expect('test'.endsWith('st')).to.be.ok;
})
it('should be falsy on incorrect results', function() {
expect('test'.endsWith('te')).to.not.be.ok();
expect(''.endsWith('/')).to.not.be.ok();
expect('#'.endsWith('/')).to.not.be.ok();
expect('##'.endsWith('///')).to.not.be.ok();
expect('test'.endsWith('te')).to.not.be.ok;
expect(''.endsWith('/')).to.not.be.ok;
expect('#'.endsWith('/')).to.not.be.ok;
expect('##'.endsWith('///')).to.not.be.ok;
});

@@ -38,16 +38,9 @@ });

it('should be truthy on correct results', function() {
expect('test'.contains('es')).to.be.ok();
expect('test'.contains('es')).to.be.ok;
});
it('should be falsy on incorrect results', function() {
expect('test'.contains('1290')).to.not.be.ok();
expect('test'.contains('1290')).to.not.be.ok;
});
});
describe('#toArray()', function() {
it('should convert string to array of strings', function() {
expect('string'.toArray()).to.eql(['s', 't', 'r', 'i', 'n', 'g']);
expect(''.toArray()).to.eql([]);
});
});
});

@@ -1,2 +0,2 @@

expect = require('expect.js');
expect = require('chai').expect;
require('../');

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc