Comparing version 0.2.0 to 0.2.1
@@ -1,10 +0,5 @@ | ||
(function(definition) { | ||
// RequireJS. | ||
if (typeof define === 'function') { | ||
define(definition); | ||
// CommonJS and <script>. | ||
} else { | ||
definition(); | ||
} | ||
})(function() { | ||
({define: (typeof define === 'function') | ||
? define // RequireJS | ||
: function(definition) {definition();} // CommonJS and <script> | ||
}).define(function() { | ||
'use strict'; | ||
@@ -15,16 +10,3 @@ | ||
var global_isFinite = globall.isFinite; | ||
var unique = function(array) { | ||
var result = []; | ||
var item; | ||
for (var i = 0, length = array.length; i < length; i++) { | ||
item = array[i]; | ||
if (result.indexOf(item) === -1) { | ||
result.push(item); | ||
} | ||
} | ||
return result; | ||
}; | ||
var defineProperty = function(object, name, method) { | ||
@@ -58,3 +40,4 @@ if (!object[name]) { | ||
var t = String(s); | ||
return this.lastIndexOf(t) === this.length - t.length; | ||
var index = this.lastIndexOf(t) | ||
return index >= 0 && index === this.length - t.length; | ||
}, | ||
@@ -131,7 +114,12 @@ | ||
var proto = Object.getPrototypeOf(subject); | ||
var property; | ||
while (proto !== null) { | ||
result = result.concat(Object.getOwnPropertyNames(proto)); | ||
Object.getOwnPropertyNames(proto).forEach(function(property) { | ||
if (result.indexOf(property) === -1) { | ||
result.push(property); | ||
} | ||
}); | ||
proto = Object.getPrototypeOf(proto); | ||
} | ||
return unique(result); | ||
return result; | ||
}, | ||
@@ -138,0 +126,0 @@ |
{ | ||
"author": "Paul Miller <paulmillr@me.com> (http://paulmillr.com/)", | ||
"author": "Paul Miller (http://paulmillr.com/)", | ||
"name": "es6-shim", | ||
"description": "ECMAScript 6 (Harmony) compatibility shims for legacy JavaScript engines", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"homepage": "https://github.com/paulmillr/es6-shim/", | ||
@@ -7,0 +7,0 @@ "repository": { |
@@ -24,2 +24,4 @@ # ES6 Shim | ||
## License | ||
The project was initially based on [es6-shim by Axel Rauschmayer](https://github.com/rauschma/es6-shim). | ||
The MIT License (MIT) | ||
@@ -26,0 +28,0 @@ |
@@ -28,2 +28,5 @@ var expect = require('expect.js'); | ||
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(); | ||
}); | ||
@@ -30,0 +33,0 @@ }); |
19778
15
47
472