core-js 0.8.3 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -16
- package/bower.json +1 -1
- package/build/build.ls +20 -8
- package/client/core.js +3376 -2996
- package/client/core.min.js +3 -3
- package/client/core.min.js.map +1 -1
- package/client/library.js +3294 -2922
- package/client/library.min.js +3 -4
- package/client/library.min.js.map +1 -1
- package/client/shim.js +2771 -2443
- package/client/shim.min.js +3 -3
- package/client/shim.min.js.map +1 -1
- package/library/modules/es7.object.to-array.js +1 -1
- package/library/modules/web.dom.iterable.js +7 -6
- package/library/modules/web.timers.js +6 -5
- package/modules/es7.object.to-array.js +1 -1
- package/modules/web.dom.iterable.js +7 -6
- package/modules/web.timers.js +6 -5
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1035,23 +1035,51 @@ dict.toString; // => undefined
|
|
|
1035
1035
|
Dict.isDict({}); // => false
|
|
1036
1036
|
Dict.isDict(Dict()); // => true
|
|
1037
1037
|
```
|
|
1038
|
-
`Dict.keys`, `Dict.values` and `Dict.entries` returns iterators for objects, [examples](http://goo.gl/
|
|
1038
|
+
`Dict.keys`, `Dict.values` and `Dict.entries` returns iterators for objects, [examples](http://goo.gl/4u8UDK):
|
|
1039
1039
|
```javascript
|
|
1040
1040
|
var dict = {a: 1, b: 2, c: 3};
|
|
1041
1041
|
|
|
1042
1042
|
for(var key of Dict.keys(dict))log(key); // => 'a', 'b', 'c'
|
|
1043
1043
|
|
|
1044
|
+
for(var val of Dict.values(dict))log(val); // => 1, 2, 3
|
|
1045
|
+
|
|
1044
1046
|
for(var [key, val] of Dict.entries(dict)){
|
|
1045
1047
|
log(key); // => 'a', 'b', 'c'
|
|
1046
1048
|
log(val); // => 1, 2, 3
|
|
1047
1049
|
}
|
|
1048
1050
|
|
|
1049
|
-
$for(Dict.values(dict)).of(log); // => 1, 2, 3
|
|
1050
|
-
|
|
1051
1051
|
new Map(Dict.entries(dict)); // => Map {a: 1, b: 2, c: 3}
|
|
1052
1052
|
|
|
1053
1053
|
new Map((for([k, v] of Dict.entries(dict))if(v % 2)[k + k, v * v])); // => Map {aa: 1, cc: 9}
|
|
1054
1054
|
```
|
|
1055
|
+
Basic dict operations for objects with prototype [example](http://goo.gl/B28UnG):
|
|
1056
|
+
```js
|
|
1057
|
+
'q' in {q: 1}; // => true
|
|
1058
|
+
'toString' in {}; // => true
|
|
1059
|
+
|
|
1060
|
+
Dict.has({q: 1}, 'q'); // => true
|
|
1061
|
+
Dict.has({}, 'toString'); // => false
|
|
1062
|
+
|
|
1063
|
+
({q: 1})['q']; // => 1
|
|
1064
|
+
({}).toString; // => function toString(){ [native code] }
|
|
1065
|
+
|
|
1066
|
+
Dict.get({q: 1}, 'q'); // => 1
|
|
1067
|
+
Dict.get({}, 'toString'); // => undefined
|
|
1068
|
+
|
|
1069
|
+
var O = {};
|
|
1070
|
+
O['q'] = 1;
|
|
1071
|
+
O['q']; // => 1
|
|
1072
|
+
O['__proto__'] = {w: 2};
|
|
1073
|
+
O['__proto__']; // => {w: 2}
|
|
1074
|
+
O['w']; // => 2
|
|
1075
|
+
|
|
1076
|
+
var O = {};
|
|
1077
|
+
Dict.set(O, 'q', 1);
|
|
1078
|
+
O['q']; // => 1
|
|
1079
|
+
Dict.set(O, '__proto__', {w: 2});
|
|
1080
|
+
O['__proto__']; // => {w: 2}
|
|
1081
|
+
O['w']; // => undefined
|
|
1082
|
+
```
|
|
1055
1083
|
Other methods of `Dict` module are static equialents of `Array.prototype` methods for dictionaries, [examples](http://goo.gl/yARYXR):
|
|
1056
1084
|
```javascript
|
|
1057
1085
|
var dict = {a: 1, b: 2, c: 3};
|
|
@@ -1231,12 +1259,10 @@ Number
|
|
|
1231
1259
|
#random(lim = 0) -> num
|
|
1232
1260
|
#{...Math}
|
|
1233
1261
|
```
|
|
1234
|
-
Number Iterator [examples](http://goo.gl/
|
|
1262
|
+
Number Iterator [examples](http://goo.gl/RI60Ot):
|
|
1235
1263
|
```javascript
|
|
1236
1264
|
for(var i of 3)log(i); // => 0, 1, 2
|
|
1237
1265
|
|
|
1238
|
-
$for(3).of(log); // => 0, 1, 2
|
|
1239
|
-
|
|
1240
1266
|
Array.from(10, Math.random); // => [0.9817775336559862, 0.02720663254149258, ...]
|
|
1241
1267
|
|
|
1242
1268
|
Array.from(10); // => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
@@ -1249,16 +1275,6 @@ Array.from(10, function(it){
|
|
|
1249
1275
|
[for(i of 10)if(i % 2)i * i]; // => [1, 9, 25, 49, 81]
|
|
1250
1276
|
|
|
1251
1277
|
Dict((for(i of 3)['key' + i, !(i % 2)])); // => {key0: true, key1: false, key2: true}
|
|
1252
|
-
|
|
1253
|
-
$for(10).filter(function(i){
|
|
1254
|
-
return i % 2;
|
|
1255
|
-
}).array(function(i){
|
|
1256
|
-
return i * i;
|
|
1257
|
-
}); // => [1, 9, 25, 49, 81]
|
|
1258
|
-
|
|
1259
|
-
Dict($for(3).map(function(i){
|
|
1260
|
-
return ['key' + i, !(i % 2)];
|
|
1261
|
-
})); // => {key0: true, key1: false, key2: true}
|
|
1262
1278
|
```
|
|
1263
1279
|
`Math` methods in `Number.prototype` [examples](http://goo.gl/06bs1k):
|
|
1264
1280
|
```javascript
|
|
@@ -1297,6 +1313,9 @@ delay(1e3).then(() => log('after 1 sec'));
|
|
|
1297
1313
|
```
|
|
1298
1314
|
|
|
1299
1315
|
## Changelog
|
|
1316
|
+
##### 0.8.4 - 2015.04.18
|
|
1317
|
+
* uses `webpack` instead of `browserify` for browser builds - more compression-friendly result
|
|
1318
|
+
|
|
1300
1319
|
##### 0.8.3 - 2015.04.14
|
|
1301
1320
|
* fixed `Array` statics with single entry points
|
|
1302
1321
|
|
package/bower.json
CHANGED
package/build/build.ls
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require! {'./config': {banner}, fs: {readFile, writeFile, unlink},
|
|
1
|
+
require! {'./config': {banner}, fs: {readFile, writeFile, unlink}, webpack, '../': core}
|
|
2
2
|
list = <[
|
|
3
3
|
es5
|
|
4
4
|
es6.symbol
|
|
@@ -62,6 +62,12 @@ list = <[
|
|
|
62
62
|
exp = <[ ]>
|
|
63
63
|
|
|
64
64
|
x78 = '*'repeat 78
|
|
65
|
+
|
|
66
|
+
check = (err)!->
|
|
67
|
+
if err
|
|
68
|
+
console.error err
|
|
69
|
+
process.exit 1
|
|
70
|
+
|
|
65
71
|
module.exports = ({modules, blacklist, library}, next)-> let @ = modules.turn ((memo, it)-> memo[it] = on), {}
|
|
66
72
|
if @exp => for exp => @[..] = on
|
|
67
73
|
for ns of @
|
|
@@ -74,13 +80,19 @@ module.exports = ({modules, blacklist, library}, next)-> let @ = modules.turn ((
|
|
|
74
80
|
if name is ns or name.startsWith "#ns."
|
|
75
81
|
@[name] = no
|
|
76
82
|
if library => @ <<< {-\es6.object.prototype, -\es6.function, -\es6.regexp, -\es6.number.constructor, -\core.iterator}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
err
|
|
81
|
-
|
|
82
|
-
err <-!
|
|
83
|
-
|
|
83
|
+
ENTRY = "./__tmp#{ Math.random! }__.js"
|
|
84
|
+
PATH = ".#{ if library => '/library' else '' }/modules/"
|
|
85
|
+
err <-! writeFile ENTRY, list.filter(~> @[it]).map(-> "require('#PATH#it');" ).join '\n'
|
|
86
|
+
check err
|
|
87
|
+
TARGET = "./__tmp#{ Math.random! }__.js"
|
|
88
|
+
err, info <-! webpack entry: ENTRY, output: { path: '', filename: TARGET }
|
|
89
|
+
check err
|
|
90
|
+
err, script <-! readFile TARGET
|
|
91
|
+
check err
|
|
92
|
+
err <-! unlink ENTRY
|
|
93
|
+
check err
|
|
94
|
+
err <-! unlink TARGET
|
|
95
|
+
check err
|
|
84
96
|
next """
|
|
85
97
|
#banner
|
|
86
98
|
!function(undefined){
|