ende 0.5.6 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/component.json +2 -2
  3. data/components/component/bind/{0.0.1 → 1.0.0}/component.json +1 -1
  4. data/components/component/bind/{0.0.1 → 1.0.0}/index.js +1 -2
  5. data/components/component/jquery/1.0.0/component.json +10 -0
  6. data/components/component/jquery/1.0.0/index.js +10308 -0
  7. data/components/component/matches-selector/{0.1.2 → 0.1.4}/component.json +1 -1
  8. data/components/component/matches-selector/{0.1.2 → 0.1.4}/index.js +0 -0
  9. data/components/indefinido/advisable/master/component.json +1 -1
  10. data/components/indefinido/indemma/master/component.json +4 -7
  11. data/components/indefinido/indemma/master/lib/record.js +7 -2
  12. data/components/indefinido/indemma/master/lib/record/dirtyable.js +15 -6
  13. data/components/indefinido/indemma/master/lib/record/scopable.js +1 -1
  14. data/components/indefinido/observable/es6-modules/component.json +1 -1
  15. data/components/indefinido/observable/es6-modules/lib/legacy/schedulerable.js +8 -3
  16. data/components/indefinido/observable/es6-modules/lib/observable.js +0 -1
  17. data/components/indefinido/observable/es6-modules/lib/observable/observation.js +2 -2
  18. data/components/paulmillr/es6-shim/{0.10.1 → 0.14.0}/component.json +1 -1
  19. data/components/paulmillr/es6-shim/{0.10.1 → 0.14.0}/es6-shim.js +151 -102
  20. data/components/pluma/assimilate/{0.3.0 → 0.4.0}/component.json +2 -2
  21. data/components/pluma/assimilate/{0.3.0 → 0.4.0}/dist/assimilate.js +1 -1
  22. data/lib/assets/javascripts/aura/extensions/rivets.js.coffee +12 -6
  23. data/lib/assets/javascripts/config/load_components.js.coffee +1 -1
  24. data/lib/assets/javascripts/ende.js.coffee +1 -1
  25. data/lib/ende/version.rb +1 -1
  26. data/vendor/assets/component/build.css +112 -0
  27. data/vendor/assets/components/ende_build.js +20357 -19584
  28. metadata +13 -84
  29. data/components/chaijs/assertion-error/1.0.0/component.json +0 -18
  30. data/components/chaijs/assertion-error/1.0.0/index.js +0 -110
  31. data/components/chaijs/chai/1.9.1/.gitignore +0 -22
  32. data/components/chaijs/chai/1.9.1/.mailmap +0 -1
  33. data/components/chaijs/chai/1.9.1/.npmignore +0 -14
  34. data/components/chaijs/chai/1.9.1/.travis.yml +0 -14
  35. data/components/chaijs/chai/1.9.1/CONTRIBUTING.md +0 -173
  36. data/components/chaijs/chai/1.9.1/History.md +0 -895
  37. data/components/chaijs/chai/1.9.1/Makefile +0 -93
  38. data/components/chaijs/chai/1.9.1/README.md +0 -99
  39. data/components/chaijs/chai/1.9.1/ReleaseNotes.md +0 -482
  40. data/components/chaijs/chai/1.9.1/bower.json +0 -27
  41. data/components/chaijs/chai/1.9.1/chai.js +0 -4782
  42. data/components/chaijs/chai/1.9.1/component.json +0 -50
  43. data/components/chaijs/chai/1.9.1/index.js +0 -1
  44. data/components/chaijs/chai/1.9.1/karma.conf.js +0 -28
  45. data/components/chaijs/chai/1.9.1/karma.sauce.js +0 -41
  46. data/components/chaijs/chai/1.9.1/lib/chai.js +0 -87
  47. data/components/chaijs/chai/1.9.1/lib/chai/assertion.js +0 -130
  48. data/components/chaijs/chai/1.9.1/lib/chai/config.js +0 -50
  49. data/components/chaijs/chai/1.9.1/lib/chai/core/assertions.js +0 -1314
  50. data/components/chaijs/chai/1.9.1/lib/chai/interface/assert.js +0 -1056
  51. data/components/chaijs/chai/1.9.1/lib/chai/interface/expect.js +0 -12
  52. data/components/chaijs/chai/1.9.1/lib/chai/interface/should.js +0 -78
  53. data/components/chaijs/chai/1.9.1/lib/chai/utils/addChainableMethod.js +0 -111
  54. data/components/chaijs/chai/1.9.1/lib/chai/utils/addMethod.js +0 -43
  55. data/components/chaijs/chai/1.9.1/lib/chai/utils/addProperty.js +0 -40
  56. data/components/chaijs/chai/1.9.1/lib/chai/utils/flag.js +0 -32
  57. data/components/chaijs/chai/1.9.1/lib/chai/utils/getActual.js +0 -18
  58. data/components/chaijs/chai/1.9.1/lib/chai/utils/getEnumerableProperties.js +0 -25
  59. data/components/chaijs/chai/1.9.1/lib/chai/utils/getMessage.js +0 -49
  60. data/components/chaijs/chai/1.9.1/lib/chai/utils/getName.js +0 -20
  61. data/components/chaijs/chai/1.9.1/lib/chai/utils/getPathValue.js +0 -102
  62. data/components/chaijs/chai/1.9.1/lib/chai/utils/getProperties.js +0 -35
  63. data/components/chaijs/chai/1.9.1/lib/chai/utils/index.js +0 -114
  64. data/components/chaijs/chai/1.9.1/lib/chai/utils/inspect.js +0 -320
  65. data/components/chaijs/chai/1.9.1/lib/chai/utils/objDisplay.js +0 -49
  66. data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteChainableMethod.js +0 -53
  67. data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteMethod.js +0 -51
  68. data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteProperty.js +0 -54
  69. data/components/chaijs/chai/1.9.1/lib/chai/utils/test.js +0 -26
  70. data/components/chaijs/chai/1.9.1/lib/chai/utils/transferFlags.js +0 -44
  71. data/components/chaijs/chai/1.9.1/lib/chai/utils/type.js +0 -45
  72. data/components/chaijs/chai/1.9.1/package.json +0 -42
  73. data/components/chaijs/chai/1.9.1/sauce.browsers.js +0 -128
  74. data/components/chaijs/chai/1.9.1/support/sauce/sauce_connect_block.sh +0 -7
  75. data/components/chaijs/chai/1.9.1/support/sauce/sauce_connect_setup.sh +0 -53
  76. data/components/chaijs/chai/1.9.1/test/assert.js +0 -638
  77. data/components/chaijs/chai/1.9.1/test/auth/.gitkeep +0 -0
  78. data/components/chaijs/chai/1.9.1/test/bootstrap/index.js +0 -22
  79. data/components/chaijs/chai/1.9.1/test/bootstrap/karma.js +0 -22
  80. data/components/chaijs/chai/1.9.1/test/configuration.js +0 -133
  81. data/components/chaijs/chai/1.9.1/test/display/errors.js +0 -14
  82. data/components/chaijs/chai/1.9.1/test/display/message.js +0 -47
  83. data/components/chaijs/chai/1.9.1/test/expect.js +0 -814
  84. data/components/chaijs/chai/1.9.1/test/globalShould.js +0 -15
  85. data/components/chaijs/chai/1.9.1/test/plugins.js +0 -24
  86. data/components/chaijs/chai/1.9.1/test/should.js +0 -744
  87. data/components/chaijs/chai/1.9.1/test/utilities.js +0 -309
  88. data/components/chaijs/deep-eql/0.1.3/component.json +0 -20
  89. data/components/chaijs/deep-eql/0.1.3/lib/eql.js +0 -257
  90. data/components/chaijs/type-detect/0.1.1/component.json +0 -18
  91. data/components/chaijs/type-detect/0.1.1/lib/type.js +0 -142
  92. data/components/component/classes/1.2.1/component.json +0 -19
  93. data/components/component/classes/1.2.1/index.js +0 -184
  94. data/components/component/domify/1.2.2/component.json +0 -22
  95. data/components/component/domify/1.2.2/index.js +0 -87
  96. data/components/component/event/0.1.3/component.json +0 -13
  97. data/components/component/event/0.1.3/index.js +0 -35
  98. data/components/component/jquery/1.9.1/component.json +0 -14
  99. data/components/component/jquery/1.9.1/index.js +0 -9601
  100. data/components/component/query/0.0.3/component.json +0 -23
  101. data/components/component/query/0.0.3/index.js +0 -21
  102. data/lib/tasks/.gitkeep +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "matches-selector",
3
3
  "description": "Check if an element matches a given selector",
4
- "version": "0.1.2",
4
+ "version": "0.1.4",
5
5
  "keywords": [
6
6
  "match",
7
7
  "element",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "advisable",
3
3
  "description": "Aspect oriented programming mixin",
4
- "version": "0.0.1",
4
+ "version": "0.1.0",
5
5
  "keywords": [
6
6
  "aspect",
7
7
  "aop",
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "indemma",
3
+ "repository": "indefinido/indemma",
3
4
  "description": "Indemma (mind picture = memory), client side ES5 observable REST model",
4
- "version": "0.2.1",
5
+ "version": "0.2.3",
5
6
  "keywords": [],
6
7
  "dependencies": {
7
- "pluma/assimilate": "0.3.0",
8
+ "pluma/assimilate": "0.4.0",
8
9
  "component/type": "*",
9
10
  "component/bind": "*",
10
11
  "component/jquery": "*",
@@ -21,9 +22,6 @@
21
22
  ]
22
23
  },
23
24
  "license": "WTFPL",
24
- "paths": [
25
- "vendor/components"
26
- ],
27
25
  "scripts": [
28
26
  "index.js",
29
27
  "lib/extensions/rivets.js",
@@ -50,6 +48,5 @@
50
48
  "lib/record/validations/validatorable.js",
51
49
  "vendor/stampit.js",
52
50
  "vendor/owl/pluralize.js"
53
- ],
54
- "repository": "indefinido/indemma"
51
+ ]
55
52
  }
@@ -95,7 +95,7 @@ this.model = (function() {
95
95
  return instance;
96
96
  };
97
97
  mixer = function(options) {
98
- var after_initialize, callback, instance, _i, _len, _ref;
98
+ var after_initialize, after_mix, callback, instance, _i, _len, _ref;
99
99
 
100
100
  if (this === window) {
101
101
  throw 'Model mixin called incorrectly call with model.call {} instead of model({})';
@@ -108,12 +108,17 @@ this.model = (function() {
108
108
  } else {
109
109
  after_initialize = [];
110
110
  }
111
+ if (this.after_mix) {
112
+ after_mix = this.after_mix.splice(0);
113
+ } else {
114
+ after_mix = [];
115
+ }
111
116
  instance = bind(this, initialize_record);
112
117
  extend(instance, merge(this, modelable));
113
118
  this.record = instance.record = merge({}, instance.record, modelable.record);
114
119
  this.record.after_initialize = instance.record.after_initialize = instance.record.after_initialize.concat(after_initialize);
115
120
  this.record.before_initialize = instance.record.before_initialize.concat([]);
116
- _ref = modelable.after_mix;
121
+ _ref = modelable.after_mix.concat(after_mix);
117
122
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
118
123
  callback = _ref[_i];
119
124
  callback.call(instance, instance);
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
- var dirtyable, model, record;
2
+ var dirt, dirtyable, model, record;
3
3
 
4
4
  dirtyable = {
5
5
  ignores: ['dirty', 'resource', 'route', 'initial_route', 'after_initialize', 'before_initialize', 'parent_resource', 'nested_attributes', 'reloading', 'ready', 'saving', 'salvation', 'sustained', 'element', 'default', 'lock', 'validated', 'validation', 'errors', 'dirty'],
6
- change: function(name) {
6
+ reserved_filter: function(name) {
7
7
  return dirtyable.ignores.indexOf(name) === -1;
8
8
  },
9
9
  descriptor: {
@@ -11,9 +11,7 @@ dirtyable = {
11
11
  return this.observed.dirty;
12
12
  },
13
13
  set: function(value) {
14
- this.observed.dirty = value;
15
- this.observation.scheduler.schedule();
16
- return value;
14
+ return this.observed.dirty = value;
17
15
  }
18
16
  },
19
17
  record: {
@@ -21,12 +19,23 @@ dirtyable = {
21
19
  Object.defineProperty(this, 'dirty', dirtyable.descriptor);
22
20
  this.observed.dirty = !!this._id;
23
21
  return this.subscribe(function(added, removed, changed, past) {
24
- return this.dirty || (this.dirty = !!Object.keys(changed).filter(dirtyable.change).length);
22
+ this.dirty || (this.dirty = !!Object.keys(changed).filter(dirtyable.reserved_filter).length);
23
+ this.dirty || (this.dirty = !!Object.keys(added).filter(dirtyable.reserved_filter).length);
24
+ return this.dirty || (this.dirty = !!Object.keys(removed).filter(dirtyable.reserved_filter).length);
25
25
  });
26
26
  }
27
27
  }
28
28
  };
29
29
 
30
+ if (!Object.observe) {
31
+ dirt = dirtyable.descriptor.set;
32
+ dirtyable.descriptor.set = function(value) {
33
+ value = dirt.apply(this, arguments);
34
+ this.observation.scheduler.schedule();
35
+ return value;
36
+ };
37
+ }
38
+
30
39
  model = window.model;
31
40
 
32
41
  record = window.record;
@@ -43,7 +43,7 @@ scopable = {
43
43
  } else {
44
44
  this["$" + name] = defaults[type] || type;
45
45
  }
46
- if ($.type(type) !== 'string') {
46
+ if ($.type(type) !== 'string' || type.toString() === '') {
47
47
  type = $.type(type);
48
48
  }
49
49
  builder = builders[type];
@@ -2,7 +2,7 @@
2
2
  "name": "observable",
3
3
  "repository": "indefinido/observable",
4
4
  "description": "Observable capabilities built upon observable shim.",
5
- "version": "0.2.2",
5
+ "version": "0.2.3",
6
6
  "keywords": [],
7
7
  "dependencies": {
8
8
  "component/jquery": "*"
@@ -117,15 +117,20 @@ schedulerable.schedulable_observers = function() {
117
117
  };
118
118
 
119
119
  schedulerable.augment = function(observable) {
120
- var original;
120
+ var subscribe, unobserve;
121
121
 
122
- original = observable.methods.subscribe;
122
+ subscribe = observable.methods.subscribe;
123
123
  observable.methods.subscribe = function(keypath, callback) {
124
- original.apply(this, arguments);
124
+ subscribe.apply(this, arguments);
125
125
  if (typeof keypath !== 'function') {
126
126
  return this.observation.scheduler.schedulable(this, keypath);
127
127
  }
128
128
  };
129
+ unobserve = observable.unobserve;
130
+ observable.unobserve = function() {
131
+ unobserve.apply(this, arguments);
132
+ return object.observation.scheduler.destroy();
133
+ };
129
134
  return jQuery.extend((function() {
130
135
  var object;
131
136
 
@@ -52,7 +52,6 @@ jQuery.extend(observable, {
52
52
  delete object[name];
53
53
  }
54
54
  object.observation.destroy();
55
- object.observation.scheduler.destroy();
56
55
  delete object.observation;
57
56
  delete object.observed;
58
57
  return object;
@@ -7,14 +7,14 @@ observation = {
7
7
  remove: function(keypath, callback) {
8
8
  return this.observers[keypath].remove(callback);
9
9
  },
10
- deliver: function() {
10
+ deliver: function(discard) {
11
11
  var keypath, observer, _ref, _results;
12
12
 
13
13
  _ref = this.observers;
14
14
  _results = [];
15
15
  for (keypath in _ref) {
16
16
  observer = _ref[keypath];
17
- _results.push(observer.deliver());
17
+ _results.push(observer.deliver(discard));
18
18
  }
19
19
  return _results;
20
20
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es6-shim",
3
- "version": "0.10.1",
3
+ "version": "0.14.0",
4
4
  "description": "ECMAScript 6 (Harmony) compatibility shims for legacy JavaScript engines",
5
5
  "keywords": [
6
6
  "ecmascript",
@@ -1,4 +1,4 @@
1
- // ES6-shim 0.10.1 (c) 2013-2014 Paul Miller (http://paulmillr.com)
1
+ // ES6-shim 0.14.0 (c) 2013-2014 Paul Miller (http://paulmillr.com)
2
2
  // ES6-shim may be freely distributed under the MIT license.
3
3
  // For more details and documentation:
4
4
  // https://github.com/paulmillr/es6-shim/
@@ -48,8 +48,12 @@
48
48
  return rejectsRegex;
49
49
  };
50
50
 
51
+ /*jshint evil: true */
52
+ var getGlobal = new Function('return this;');
53
+ /*jshint evil: false */
54
+
51
55
  var main = function() {
52
- var globals = (typeof global === 'undefined') ? window : global;
56
+ var globals = getGlobal();
53
57
  var global_isFinite = globals.isFinite;
54
58
  var supportsDescriptors = !!Object.defineProperty && arePropertyDescriptorsSupported();
55
59
  var startsWithIsCompliant = startsWithRejectsRegex();
@@ -57,6 +61,7 @@
57
61
  var _indexOf = String.prototype.indexOf;
58
62
  var _toString = Object.prototype.toString;
59
63
  var _hasOwnProperty = Object.prototype.hasOwnProperty;
64
+ var ArrayIterator; // make our implementation private
60
65
 
61
66
  // Define configurable, writable and non-enumerable props
62
67
  // if they don’t exist.
@@ -77,12 +82,24 @@
77
82
  });
78
83
  };
79
84
 
85
+ // Simple shim for Object.create on ES3 browsers
86
+ // (unlike real shim, no attempt to support `prototype === null`)
87
+ var create = Object.create || function(prototype, properties) {
88
+ function Type() {}
89
+ Type.prototype = prototype;
90
+ var object = new Type();
91
+ if (typeof properties !== "undefined") {
92
+ defineProperties(object, properties);
93
+ }
94
+ return object;
95
+ };
96
+
80
97
  // This is a private name in the es6 spec, equal to '[Symbol.iterator]'
81
98
  // we're going to use an arbitrary _-prefixed name to make our shims
82
99
  // work properly with each other, even though we don't have full Iterator
83
100
  // support. That is, `Array.from(map.keys())` will work, but we don't
84
101
  // pretend to export a "real" Iterator interface.
85
- var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) ||
102
+ var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) ||
86
103
  '_es6shim_iterator_';
87
104
  // Firefox ships a partial implementation using the name @@iterator.
88
105
  // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14
@@ -221,7 +238,7 @@
221
238
  obj = C['@@create']();
222
239
  } else {
223
240
  // OrdinaryCreateFromConstructor
224
- obj = Object.create(C.prototype || null);
241
+ obj = create(C.prototype || null);
225
242
  }
226
243
  // Mark that we've used the es6 construct path
227
244
  // (see emulateES6construct)
@@ -311,8 +328,8 @@
311
328
  // Bits to bytes
312
329
  bytes = [];
313
330
  while (str.length) {
314
- bytes.push(parseInt(str.substring(0, 8), 2));
315
- str = str.substring(8);
331
+ bytes.push(parseInt(str.slice(0, 8), 2));
332
+ str = str.slice(8);
316
333
  }
317
334
  return bytes;
318
335
  }
@@ -334,9 +351,9 @@
334
351
 
335
352
  // Unpack sign, exponent, fraction
336
353
  bias = (1 << (ebits - 1)) - 1;
337
- s = parseInt(str.substring(0, 1), 2) ? -1 : 1;
338
- e = parseInt(str.substring(1, 1 + ebits), 2);
339
- f = parseInt(str.substring(1 + ebits), 2);
354
+ s = parseInt(str.slice(0, 1), 2) ? -1 : 1;
355
+ e = parseInt(str.slice(1, 1 + ebits), 2);
356
+ f = parseInt(str.slice(1 + ebits), 2);
340
357
 
341
358
  // Produce number
342
359
  if (e === (1 << ebits) - 1) {
@@ -371,7 +388,7 @@
371
388
  }());
372
389
 
373
390
  defineProperties(String, {
374
- fromCodePoint: function() {
391
+ fromCodePoint: function(_) { // length = 1
375
392
  var points = _slice.call(arguments, 0, arguments.length);
376
393
  var result = [];
377
394
  var next;
@@ -489,6 +506,31 @@
489
506
  };
490
507
  defineProperties(String.prototype, StringShims);
491
508
 
509
+ var hasStringTrimBug = '\u0085'.trim().length !== 1;
510
+ if (hasStringTrimBug) {
511
+ var originalStringTrim = String.prototype.trim;
512
+ delete String.prototype.trim;
513
+ // whitespace from: http://es5.github.io/#x15.5.4.20
514
+ // implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324
515
+ var ws = [
516
+ '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003',
517
+ '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028',
518
+ '\u2029\uFEFF'
519
+ ].join('');
520
+ var trimBeginRegexp = new RegExp('^[' + ws + '][' + ws + ']*');
521
+ var trimEndRegexp = new RegExp('[' + ws + '][' + ws + ']*$');
522
+ defineProperties(String.prototype, {
523
+ trim: function() {
524
+ if (this === undefined || this === null) {
525
+ throw new TypeError("can't convert " + this + " to object");
526
+ }
527
+ return String(this)
528
+ .replace(trimBeginRegexp, "")
529
+ .replace(trimEndRegexp, "");
530
+ }
531
+ });
532
+ }
533
+
492
534
  // see https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype-@@iterator
493
535
  var StringIterator = function(s) {
494
536
  this._s = String(ES.CheckObjectCoercible(s));
@@ -496,7 +538,7 @@
496
538
  };
497
539
  StringIterator.prototype.next = function() {
498
540
  var s = this._s, i = this._i;
499
- if (s===undefined || i >= s.length) {
541
+ if (s === undefined || i >= s.length) {
500
542
  this._s = undefined;
501
543
  return { value: undefined, done: true };
502
544
  }
@@ -551,8 +593,8 @@
551
593
  } else {
552
594
  value = list[i];
553
595
  }
554
- if (mapFn !== undefined) {
555
- result[i] = thisArg ? mapFn.call(thisArg, value) : mapFn(value);
596
+ if (mapFn) {
597
+ result[i] = thisArg ? mapFn.call(thisArg, value, i) : mapFn(value, i);
556
598
  } else {
557
599
  result[i] = value;
558
600
  }
@@ -567,18 +609,18 @@
567
609
  }
568
610
  });
569
611
 
570
- defineProperties(globals, {
571
- ArrayIterator: function(array, kind) {
612
+ // Our ArrayIterator is private; see
613
+ // https://github.com/paulmillr/es6-shim/issues/252
614
+ ArrayIterator = function(array, kind) {
572
615
  this.i = 0;
573
616
  this.array = array;
574
617
  this.kind = kind;
575
- }
576
- });
618
+ };
577
619
 
578
620
  defineProperties(ArrayIterator.prototype, {
579
621
  next: function() {
580
622
  var i = this.i, array = this.array;
581
- if (i===undefined || this.kind===undefined) {
623
+ if (i === undefined || this.kind === undefined) {
582
624
  throw new TypeError('Not an ArrayIterator');
583
625
  }
584
626
  if (array!==undefined) {
@@ -588,11 +630,9 @@
588
630
  var retval;
589
631
  if (kind === "key") {
590
632
  retval = i;
591
- }
592
- if (kind === "value") {
633
+ } else if (kind === "value") {
593
634
  retval = array[i];
594
- }
595
- if (kind === "entry") {
635
+ } else if (kind === "entry") {
596
636
  retval = [i, array[i]];
597
637
  }
598
638
  this.i = i + 1;
@@ -635,16 +675,19 @@
635
675
  }
636
676
  return o;
637
677
  },
678
+
638
679
  fill: function(value) {
639
- var start = arguments[1], end = arguments[2]; // fill.length===1
680
+ var start = arguments.length > 1 ? arguments[1] : undefined;
681
+ var end = arguments.length > 2 ? arguments[2] : undefined;
640
682
  var O = ES.ToObject(this);
641
683
  var len = ES.ToLength(O.length);
642
- start = ES.ToInteger(start===undefined ? 0 : start);
643
- end = ES.ToInteger(end===undefined ? len : end);
684
+ start = ES.ToInteger(start === undefined ? 0 : start);
685
+ end = ES.ToInteger(end === undefined ? len : end);
644
686
 
645
687
  var relativeStart = start < 0 ? Math.max(len + start, 0) : Math.min(start, len);
688
+ var relativeEnd = end < 0 ? len + end : end;
646
689
 
647
- for (var i = relativeStart; i < len && i < end; ++i) {
690
+ for (var i = relativeStart; i < len && i < relativeEnd; ++i) {
648
691
  O[i] = value;
649
692
  }
650
693
  return O;
@@ -696,7 +739,9 @@
696
739
  addIterator(Array.prototype, function() { return this.values(); });
697
740
  // Chrome defines keys/values/entries on Array, but doesn't give us
698
741
  // any way to identify its iterator. So add our own shimmed field.
699
- addIterator(Object.getPrototypeOf([].values()));
742
+ if (Object.getPrototypeOf) {
743
+ addIterator(Object.getPrototypeOf([].values()));
744
+ }
700
745
 
701
746
  var maxSafeInteger = Math.pow(2, 53) - 1;
702
747
  defineProperties(Number, {
@@ -712,15 +757,12 @@
712
757
  },
713
758
 
714
759
  isInteger: function(value) {
715
- return typeof value === 'number' &&
716
- !Number.isNaN(value) &&
717
- Number.isFinite(value) &&
760
+ return Number.isFinite(value) &&
718
761
  ES.ToInteger(value) === value;
719
762
  },
720
763
 
721
764
  isSafeInteger: function(value) {
722
- return Number.isInteger(value) &&
723
- Math.abs(value) <= Number.MAX_SAFE_INTEGER;
765
+ return Number.isInteger(value) && Math.abs(value) <= Number.MAX_SAFE_INTEGER;
724
766
  },
725
767
 
726
768
  isNaN: function(value) {
@@ -734,19 +776,8 @@
734
776
 
735
777
  });
736
778
 
737
- defineProperties(Number.prototype, {
738
- });
739
-
740
779
  if (supportsDescriptors) {
741
780
  defineProperties(Object, {
742
- getOwnPropertyDescriptors: function(subject) {
743
- var descs = {};
744
- Object.getOwnPropertyNames(subject).forEach(function(propName) {
745
- descs[propName] = Object.getOwnPropertyDescriptor(subject, propName);
746
- });
747
- return descs;
748
- },
749
-
750
781
  getPropertyDescriptor: function(subject, name) {
751
782
  var pd = Object.getOwnPropertyDescriptor(subject, name);
752
783
  var proto = Object.getPrototypeOf(subject);
@@ -772,20 +803,32 @@
772
803
  proto = Object.getPrototypeOf(proto);
773
804
  }
774
805
  return result;
775
- },
776
-
777
- // 19.1.3.1
778
- assign: function(target, source) {
779
- return Object.keys(source).reduce(function(target, key) {
780
- target[key] = source[key];
781
- return target;
782
- }, target);
783
806
  }
784
807
  });
785
808
 
786
- // 19.1.3.9
787
- // shim from https://gist.github.com/WebReflection/5593554
788
809
  defineProperties(Object, {
810
+ // 19.1.3.1
811
+ assign: function(target, source) {
812
+ if (!ES.TypeIsObject(target)) {
813
+ throw new TypeError('target must be an object');
814
+ }
815
+ return Array.prototype.reduce.call(arguments, function(target, source) {
816
+ if (!ES.TypeIsObject(source)) {
817
+ throw new TypeError('source must be an object');
818
+ }
819
+ return Object.keys(source).reduce(function(target, key) {
820
+ target[key] = source[key];
821
+ return target;
822
+ }, target);
823
+ });
824
+ },
825
+
826
+ is: function(a, b) {
827
+ return ES.SameValue(a, b);
828
+ },
829
+
830
+ // 19.1.3.9
831
+ // shim from https://gist.github.com/WebReflection/5593554
789
832
  setPrototypeOf: (function(Object, magic) {
790
833
  var set;
791
834
 
@@ -859,16 +902,6 @@
859
902
  })();
860
903
  }
861
904
 
862
- defineProperties(Object, {
863
- getOwnPropertyKeys: function(subject) {
864
- return Object.keys(subject);
865
- },
866
-
867
- is: function(a, b) {
868
- return ES.SameValue(a, b);
869
- }
870
- });
871
-
872
905
  try {
873
906
  Object.keys('foo');
874
907
  } catch (e) {
@@ -918,7 +951,6 @@
918
951
  clz32: function(value) {
919
952
  // See https://bugs.ecmascript.org/show_bug.cgi?id=2465
920
953
  value = Number(value);
921
- if (Number.isNaN(value)) return NaN;
922
954
  var number = ES.ToUint32(value);
923
955
  if (number === 0) {
924
956
  return 32;
@@ -940,15 +972,7 @@
940
972
  value = Number(value);
941
973
  if (value === -Infinity) return -1;
942
974
  if (!global_isFinite(value) || value === 0) return value;
943
- var result = 0;
944
- var n = 50;
945
- for (var i = 1; i < n; i++) {
946
- for (var j = 2, factorial = 1; j <= i; j++) {
947
- factorial *= j;
948
- }
949
- result += Math.pow(value, i) / factorial;
950
- }
951
- return result;
975
+ return Math.exp(value) - 1;
952
976
  },
953
977
 
954
978
  hypot: function(x, y) {
@@ -1035,6 +1059,8 @@
1035
1059
 
1036
1060
  imul: function(x, y) {
1037
1061
  // taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul
1062
+ x = ES.ToUint32(x);
1063
+ y = ES.ToUint32(y);
1038
1064
  var ah = (x >>> 16) & 0xffff;
1039
1065
  var al = x & 0xffff;
1040
1066
  var bh = (y >>> 16) & 0xffff;
@@ -1105,30 +1131,44 @@
1105
1131
 
1106
1132
  // find an appropriate setImmediate-alike
1107
1133
  var setTimeout = globals.setTimeout;
1108
- var makeZeroTimeout = function() {
1109
- // from http://dbaron.org/log/20100309-faster-timeouts
1110
- var timeouts = [];
1111
- var messageName = "zero-timeout-message";
1112
- var setZeroTimeout = function(fn) {
1113
- timeouts.push(fn);
1114
- window.postMessage(messageName, "*");
1134
+ var makeZeroTimeout;
1135
+ if (typeof window !== 'undefined' && ES.IsCallable(window.postMessage)) {
1136
+ makeZeroTimeout = function() {
1137
+ // from http://dbaron.org/log/20100309-faster-timeouts
1138
+ var timeouts = [];
1139
+ var messageName = "zero-timeout-message";
1140
+ var setZeroTimeout = function(fn) {
1141
+ timeouts.push(fn);
1142
+ window.postMessage(messageName, "*");
1143
+ };
1144
+ var handleMessage = function(event) {
1145
+ if (event.source == window && event.data == messageName) {
1146
+ event.stopPropagation();
1147
+ if (timeouts.length === 0) { return; }
1148
+ var fn = timeouts.shift();
1149
+ fn();
1150
+ }
1151
+ };
1152
+ window.addEventListener("message", handleMessage, true);
1153
+ return setZeroTimeout;
1115
1154
  };
1116
- var handleMessage = function(event) {
1117
- if (event.source == window && event.data == messageName) {
1118
- event.stopPropagation();
1119
- if (timeouts.length === 0) { return; }
1120
- var fn = timeouts.shift();
1121
- fn();
1122
- }
1155
+ }
1156
+ var makePromiseAsap = function() {
1157
+ // An efficient task-scheduler based on a pre-existing Promise
1158
+ // implementation, which we can use even if we override the
1159
+ // global Promise below (in order to workaround bugs)
1160
+ // https://github.com/Raynos/observ-hash/issues/2#issuecomment-35857671
1161
+ var P = globals.Promise;
1162
+ return P && P.resolve && function(task) {
1163
+ return P.resolve().then(task);
1123
1164
  };
1124
- window.addEventListener("message", handleMessage, true);
1125
- return setZeroTimeout;
1126
1165
  };
1127
1166
  var enqueue = ES.IsCallable(globals.setImmediate) ?
1128
1167
  globals.setImmediate.bind(globals) :
1129
1168
  typeof process === 'object' && process.nextTick ? process.nextTick :
1130
- ES.IsCallable(window.postMessage) ? makeZeroTimeout() :
1131
- function(task) { setTimeout(task, 0); }; // fallback
1169
+ makePromiseAsap() ||
1170
+ (ES.IsCallable(makeZeroTimeout) ? makeZeroTimeout() :
1171
+ function(task) { setTimeout(task, 0); }); // fallback
1132
1172
 
1133
1173
  var triggerPromiseReactions = function(reactions, x) {
1134
1174
  reactions.forEach(function(reaction) {
@@ -1239,7 +1279,7 @@
1239
1279
  // The `obj` parameter is a hack we use for es5
1240
1280
  // compatibility.
1241
1281
  var prototype = constructor.prototype || Promise$prototype;
1242
- obj = obj || Object.create(prototype);
1282
+ obj = obj || create(prototype);
1243
1283
  defineProperties(obj, {
1244
1284
  _status: undefined,
1245
1285
  _result: undefined,
@@ -1392,9 +1432,18 @@
1392
1432
  // In Chrome 33 (and thereabouts) Promise is defined, but the
1393
1433
  // implementation is buggy in a number of ways. Let's check subclassing
1394
1434
  // support to see if we have a buggy implementation.
1395
- if (!supportsSubclassing(globals.Promise, function(S) {
1435
+ var promiseSupportsSubclassing = supportsSubclassing(globals.Promise, function(S) {
1396
1436
  return S.resolve(42) instanceof S;
1397
- })) {
1437
+ });
1438
+ var promiseIgnoresNonFunctionThenCallbacks = (function () {
1439
+ try {
1440
+ globals.Promise.reject(42).then(null, 5).then(null, function () {});
1441
+ return true;
1442
+ } catch (ex) {
1443
+ return false;
1444
+ }
1445
+ }());
1446
+ if (!promiseSupportsSubclassing || !promiseIgnoresNonFunctionThenCallbacks) {
1398
1447
  globals.Promise = PromiseShim;
1399
1448
  }
1400
1449
 
@@ -1471,7 +1520,7 @@
1471
1520
  };
1472
1521
  addIterator(MapIterator.prototype);
1473
1522
 
1474
- function Map() {
1523
+ function Map(iterable) {
1475
1524
  var map = this;
1476
1525
  map = emulateES6construct(map);
1477
1526
  if (!map._es6map) {
@@ -1489,7 +1538,6 @@
1489
1538
  });
1490
1539
 
1491
1540
  // Optionally initialize map from iterable
1492
- var iterable = arguments[0];
1493
1541
  if (iterable !== undefined && iterable !== null) {
1494
1542
  var it = ES.GetIterator(iterable);
1495
1543
  var adder = map.set;
@@ -1511,7 +1559,7 @@
1511
1559
  '@@create': function(obj) {
1512
1560
  var constructor = this;
1513
1561
  var prototype = constructor.prototype || Map$prototype;
1514
- obj = obj || Object.create(prototype);
1562
+ obj = obj || create(prototype);
1515
1563
  defineProperties(obj, { _es6map: true });
1516
1564
  return obj;
1517
1565
  }
@@ -1657,7 +1705,7 @@
1657
1705
  // Sets containing only string or numeric keys, we use an object
1658
1706
  // as backing storage and lazily create a full Map only when
1659
1707
  // required.
1660
- var SetShim = function Set() {
1708
+ var SetShim = function Set(iterable) {
1661
1709
  var set = this;
1662
1710
  set = emulateES6construct(set);
1663
1711
  if (!set._es6set) {
@@ -1670,7 +1718,6 @@
1670
1718
  });
1671
1719
 
1672
1720
  // Optionally initialize map from iterable
1673
- var iterable = arguments[0];
1674
1721
  if (iterable !== undefined && iterable !== null) {
1675
1722
  var it = ES.GetIterator(iterable);
1676
1723
  var adder = set.add;
@@ -1689,7 +1736,7 @@
1689
1736
  '@@create': function(obj) {
1690
1737
  var constructor = this;
1691
1738
  var prototype = constructor.prototype || Set$prototype;
1692
- obj = obj || Object.create(prototype);
1739
+ obj = obj || create(prototype);
1693
1740
  defineProperties(obj, { _es6set: true });
1694
1741
  return obj;
1695
1742
  }
@@ -1702,7 +1749,7 @@
1702
1749
  Object.keys(set._storage).forEach(function(k) {
1703
1750
  // fast check for leading '$'
1704
1751
  if (k.charCodeAt(0) === 36) {
1705
- k = k.substring(1);
1752
+ k = k.slice(1);
1706
1753
  } else {
1707
1754
  k = +k;
1708
1755
  }
@@ -1806,6 +1853,7 @@
1806
1853
  typeof globals.Map.prototype.clear !== 'function' ||
1807
1854
  new globals.Set().size !== 0 ||
1808
1855
  new globals.Map().size !== 0 ||
1856
+ typeof globals.Map.prototype.keys !== 'function' ||
1809
1857
  typeof globals.Set.prototype.keys !== 'function' ||
1810
1858
  typeof globals.Map.prototype.forEach !== 'function' ||
1811
1859
  typeof globals.Set.prototype.forEach !== 'function' ||
@@ -1825,9 +1873,10 @@
1825
1873
  }
1826
1874
  };
1827
1875
 
1828
- if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
1876
+ if (typeof define === 'function' && define.amd) {
1829
1877
  define(main); // RequireJS
1830
1878
  } else {
1831
1879
  main(); // CommonJS and <script>
1832
1880
  }
1833
1881
  })();
1882
+