Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Dec 23, 2014
1 parent 3e98ae3 commit c4eee15
Show file tree
Hide file tree
Showing 19 changed files with 223 additions and 229 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1182,10 +1182,12 @@ var core = require('core-js/library');
require('core-js/shim');
```
## Changelog
**0.3.0** - *2014.12.23* - Optimize `Map` & `Set`
**0.3.1** - *2014.12.23* - Some fixes
**0.3.0** - *2014.12.23* - Optimize [`Map` & `Set](#ecmascript-6-collections)
* use entries chain on hash table
* fast & correct iteration
* iterators moved to `es6` and `es6_collections` modules
* iterators moved to [`es6`](#ecmascript-6) and [`es6_collections`](#ecmascript-6-collections) modules

**0.2.5** - *2014.12.20*
* `console` no longer shortcut for `console.log` (compatibility problems)
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "core.js",
"main": "client/core.js",
"version": "0.3.0",
"version": "0.3.1",
"description": "Standard Library",
"keywords": [
"ES6",
Expand Down
13 changes: 6 additions & 7 deletions build/config.ls
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
config = module.exports = {}
..version = '0.3.0'
..year = new Date!getFullYear!
..banner = """
config = module.exports = {
banner: """
/**
* Core.js #{config.version}
* Core.js #{require('../package').version}
* https://github.com/zloirock/core-js
* License: http://rock.mit-license.org
* © #{config.year} Denis Pushkarev
* © #{new Date!getFullYear!} Denis Pushkarev
*/
"""
"""
}
59 changes: 29 additions & 30 deletions client/core.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Core.js 0.3.0
* Core.js 0.3.1
* https://github.com/zloirock/core-js
* License: http://rock.mit-license.org
* © 2014 Denis Pushkarev
Expand Down Expand Up @@ -512,7 +512,10 @@ function $define(type, name, source){
// export
if(exports[key] != out)hidden(exports, key, exp);
// extend global
if(framework && target && !own && (isGlobal || delete target[key]))hidden(target, key, out);
if(framework && target && !own){
if(isGlobal)target[key] = out;
else delete target[key] && hidden(target, key, out);
}
}
}
// CommonJS export
Expand Down Expand Up @@ -1457,24 +1460,25 @@ $define(GLOBAL + BIND, {
}

function def(that, key, value){
var index = fastKey(key, true)
, values = that[DATA]
, last = that[LAST]
var index = fastKey(key, true)
, data = that[DATA]
, last = that[LAST]
, entry;
if(index in values)values[index].v = value;
if(index in data)data[index].v = value;
else {
entry = values[index] = {k: key, v: value, p: last};
entry = data[index] = {k: key, v: value, p: last};
if(!that[FIRST])that[FIRST] = entry;
if(last)last.n = entry;
that[LAST] = entry;
that[SIZE]++;
} return that;
}
function del(that, keys, index){
var entry = keys[index]
function del(that, index){
var data = that[DATA]
, entry = data[index]
, next = entry.n
, prev = entry.p;
delete keys[index];
delete data[index];
entry.r = true;
if(prev)prev.n = next;
if(next)next.p = prev;
Expand All @@ -1487,16 +1491,14 @@ $define(GLOBAL + BIND, {
// 23.1.3.1 Map.prototype.clear()
// 23.2.3.2 Set.prototype.clear()
clear: function(){
var keys = this[DATA], index;
for(index in keys)del(this, keys, index);
for(var index in this[DATA])del(this, index);
},
// 23.1.3.3 Map.prototype.delete(key)
// 23.2.3.4 Set.prototype.delete(value)
'delete': function(key){
var keys = this[DATA]
, index = fastKey(key)
, contains = index in keys;
if(contains)del(this, keys, index);
var index = fastKey(key)
, contains = index in this[DATA];
if(contains)del(this, index);
return contains;
},
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
Expand Down Expand Up @@ -2146,30 +2148,27 @@ $define(PROTO + FORCED, ARRAY, {
******************************************************************************/

!function(console, enabled){
var exports = core.console = framework ? console || (global.console = {}) : {}
, _console = console || {};
var $console = turn.call(
/**
* Methods from:
* https://github.com/DeveloperToolsWG/console-object/blob/master/api.md
* https://developer.mozilla.org/en-US/docs/Web/API/console
*/
// console methods in some browsers are not configurable
$define(GLOBAL + FORCED, {console: turn.call(
// Methods from:
// https://github.com/DeveloperToolsWG/console-object/blob/master/api.md
// https://developer.mozilla.org/en-US/docs/Web/API/console
array('assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,' +
'groupEnd,info,isIndependentlyComposed,log,markTimeline,profile,profileEnd,' +
'table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn'),
function(memo, key){
var fn = _console[key];
if(!(NODE && key in _console))hidden(memo, key, function(){
var fn = console[key];
if(!(NODE && key in console))hidden(memo, key, function(){
if(enabled && fn)return apply.call(fn, console, arguments);
});
}, assignHidden(exports, {
}, {
enable: function(){
enabled = true;
},
disable: function(){
enabled = false;
}
})
);
}(global.console, true);
}
)});
}(global.console || {}, true);
}(Function('return this'), true);
4 changes: 2 additions & 2 deletions client/core.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/core.min.map

Large diffs are not rendered by default.

59 changes: 29 additions & 30 deletions client/library.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Core.js 0.3.0
* Core.js 0.3.1
* https://github.com/zloirock/core-js
* License: http://rock.mit-license.org
* © 2014 Denis Pushkarev
Expand Down Expand Up @@ -512,7 +512,10 @@ function $define(type, name, source){
// export
if(exports[key] != out)hidden(exports, key, exp);
// extend global
if(framework && target && !own && (isGlobal || delete target[key]))hidden(target, key, out);
if(framework && target && !own){
if(isGlobal)target[key] = out;
else delete target[key] && hidden(target, key, out);
}
}
}
// CommonJS export
Expand Down Expand Up @@ -1457,24 +1460,25 @@ $define(GLOBAL + BIND, {
}

function def(that, key, value){
var index = fastKey(key, true)
, values = that[DATA]
, last = that[LAST]
var index = fastKey(key, true)
, data = that[DATA]
, last = that[LAST]
, entry;
if(index in values)values[index].v = value;
if(index in data)data[index].v = value;
else {
entry = values[index] = {k: key, v: value, p: last};
entry = data[index] = {k: key, v: value, p: last};
if(!that[FIRST])that[FIRST] = entry;
if(last)last.n = entry;
that[LAST] = entry;
that[SIZE]++;
} return that;
}
function del(that, keys, index){
var entry = keys[index]
function del(that, index){
var data = that[DATA]
, entry = data[index]
, next = entry.n
, prev = entry.p;
delete keys[index];
delete data[index];
entry.r = true;
if(prev)prev.n = next;
if(next)next.p = prev;
Expand All @@ -1487,16 +1491,14 @@ $define(GLOBAL + BIND, {
// 23.1.3.1 Map.prototype.clear()
// 23.2.3.2 Set.prototype.clear()
clear: function(){
var keys = this[DATA], index;
for(index in keys)del(this, keys, index);
for(var index in this[DATA])del(this, index);
},
// 23.1.3.3 Map.prototype.delete(key)
// 23.2.3.4 Set.prototype.delete(value)
'delete': function(key){
var keys = this[DATA]
, index = fastKey(key)
, contains = index in keys;
if(contains)del(this, keys, index);
var index = fastKey(key)
, contains = index in this[DATA];
if(contains)del(this, index);
return contains;
},
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
Expand Down Expand Up @@ -2146,30 +2148,27 @@ $define(PROTO + FORCED, ARRAY, {
******************************************************************************/

!function(console, enabled){
var exports = core.console = framework ? console || (global.console = {}) : {}
, _console = console || {};
var $console = turn.call(
/**
* Methods from:
* https://github.com/DeveloperToolsWG/console-object/blob/master/api.md
* https://developer.mozilla.org/en-US/docs/Web/API/console
*/
// console methods in some browsers are not configurable
$define(GLOBAL + FORCED, {console: turn.call(
// Methods from:
// https://github.com/DeveloperToolsWG/console-object/blob/master/api.md
// https://developer.mozilla.org/en-US/docs/Web/API/console
array('assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,' +
'groupEnd,info,isIndependentlyComposed,log,markTimeline,profile,profileEnd,' +
'table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn'),
function(memo, key){
var fn = _console[key];
if(!(NODE && key in _console))hidden(memo, key, function(){
var fn = console[key];
if(!(NODE && key in console))hidden(memo, key, function(){
if(enabled && fn)return apply.call(fn, console, arguments);
});
}, assignHidden(exports, {
}, {
enable: function(){
enabled = true;
},
disable: function(){
enabled = false;
}
})
);
}(global.console, true);
}
)});
}(global.console || {}, true);
}(Function('return this'), false);
4 changes: 2 additions & 2 deletions client/library.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/library.min.map

Large diffs are not rendered by default.

59 changes: 29 additions & 30 deletions client/shim.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Core.js 0.3.0
* Core.js 0.3.1
* https://github.com/zloirock/core-js
* License: http://rock.mit-license.org
* © 2014 Denis Pushkarev
Expand Down Expand Up @@ -512,7 +512,10 @@ function $define(type, name, source){
// export
if(exports[key] != out)hidden(exports, key, exp);
// extend global
if(framework && target && !own && (isGlobal || delete target[key]))hidden(target, key, out);
if(framework && target && !own){
if(isGlobal)target[key] = out;
else delete target[key] && hidden(target, key, out);
}
}
}
// CommonJS export
Expand Down Expand Up @@ -1457,24 +1460,25 @@ $define(GLOBAL + BIND, {
}

function def(that, key, value){
var index = fastKey(key, true)
, values = that[DATA]
, last = that[LAST]
var index = fastKey(key, true)
, data = that[DATA]
, last = that[LAST]
, entry;
if(index in values)values[index].v = value;
if(index in data)data[index].v = value;
else {
entry = values[index] = {k: key, v: value, p: last};
entry = data[index] = {k: key, v: value, p: last};
if(!that[FIRST])that[FIRST] = entry;
if(last)last.n = entry;
that[LAST] = entry;
that[SIZE]++;
} return that;
}
function del(that, keys, index){
var entry = keys[index]
function del(that, index){
var data = that[DATA]
, entry = data[index]
, next = entry.n
, prev = entry.p;
delete keys[index];
delete data[index];
entry.r = true;
if(prev)prev.n = next;
if(next)next.p = prev;
Expand All @@ -1487,16 +1491,14 @@ $define(GLOBAL + BIND, {
// 23.1.3.1 Map.prototype.clear()
// 23.2.3.2 Set.prototype.clear()
clear: function(){
var keys = this[DATA], index;
for(index in keys)del(this, keys, index);
for(var index in this[DATA])del(this, index);
},
// 23.1.3.3 Map.prototype.delete(key)
// 23.2.3.4 Set.prototype.delete(value)
'delete': function(key){
var keys = this[DATA]
, index = fastKey(key)
, contains = index in keys;
if(contains)del(this, keys, index);
var index = fastKey(key)
, contains = index in this[DATA];
if(contains)del(this, index);
return contains;
},
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
Expand Down Expand Up @@ -1720,30 +1722,27 @@ $define(GLOBAL + BIND, {
******************************************************************************/

!function(console, enabled){
var exports = core.console = framework ? console || (global.console = {}) : {}
, _console = console || {};
var $console = turn.call(
/**
* Methods from:
* https://github.com/DeveloperToolsWG/console-object/blob/master/api.md
* https://developer.mozilla.org/en-US/docs/Web/API/console
*/
// console methods in some browsers are not configurable
$define(GLOBAL + FORCED, {console: turn.call(
// Methods from:
// https://github.com/DeveloperToolsWG/console-object/blob/master/api.md
// https://developer.mozilla.org/en-US/docs/Web/API/console
array('assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,' +
'groupEnd,info,isIndependentlyComposed,log,markTimeline,profile,profileEnd,' +
'table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn'),
function(memo, key){
var fn = _console[key];
if(!(NODE && key in _console))hidden(memo, key, function(){
var fn = console[key];
if(!(NODE && key in console))hidden(memo, key, function(){
if(enabled && fn)return apply.call(fn, console, arguments);
});
}, assignHidden(exports, {
}, {
enable: function(){
enabled = true;
},
disable: function(){
enabled = false;
}
})
);
}(global.console, true);
}
)});
}(global.console || {}, true);
}(Function('return this'), true);
Loading

0 comments on commit c4eee15

Please sign in to comment.