ende 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/lib/assets/javascripts/aura/extensions/devise.js.coffee +2 -2
  3. data/lib/assets/javascripts/widgets/viewer/main.js.coffee +1 -1
  4. data/lib/ende/version.rb +1 -1
  5. data/vendor/assets/components/build.js +638 -133
  6. data/vendor/components/indefinido-indemma/.gitignore +14 -0
  7. data/vendor/components/indefinido-indemma/.gitignore~ +2 -0
  8. data/vendor/components/indefinido-indemma/.ruby-gemset +1 -0
  9. data/vendor/components/indefinido-indemma/.ruby-version +1 -0
  10. data/vendor/components/indefinido-indemma/Gemfile +13 -0
  11. data/vendor/components/indefinido-indemma/Guardfile +39 -0
  12. data/vendor/components/indefinido-indemma/History.md +0 -0
  13. data/vendor/components/indefinido-indemma/Readme.md +447 -0
  14. data/vendor/components/indefinido-indemma/build/development.js +340 -0
  15. data/vendor/components/indefinido-indemma/build/release.js +22039 -0
  16. data/vendor/components/indefinido-indemma/build/test.js +22039 -0
  17. data/vendor/components/indefinido-indemma/component.json +7 -3
  18. data/vendor/components/indefinido-indemma/components/chaijs-assertion-error/component.json +18 -0
  19. data/vendor/components/indefinido-indemma/components/chaijs-assertion-error/index.js +110 -0
  20. data/vendor/components/indefinido-indemma/components/chaijs-chai/component.json +47 -0
  21. data/vendor/components/indefinido-indemma/components/chaijs-chai/index.js +1 -0
  22. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/assertion.js +130 -0
  23. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/core/assertions.js +1270 -0
  24. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/assert.js +1080 -0
  25. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/expect.js +12 -0
  26. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/should.js +76 -0
  27. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +94 -0
  28. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addMethod.js +37 -0
  29. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addProperty.js +40 -0
  30. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/eql.js +129 -0
  31. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js +32 -0
  32. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getActual.js +19 -0
  33. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +25 -0
  34. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getMessage.js +49 -0
  35. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getName.js +20 -0
  36. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getPathValue.js +102 -0
  37. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getProperties.js +35 -0
  38. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/index.js +108 -0
  39. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/inspect.js +320 -0
  40. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/objDisplay.js +48 -0
  41. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +51 -0
  42. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +54 -0
  43. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/test.js +26 -0
  44. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/transferFlags.js +44 -0
  45. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/type.js +45 -0
  46. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai.js +80 -0
  47. data/vendor/components/indefinido-indemma/components/component-bind/component.json +14 -0
  48. data/vendor/components/indefinido-indemma/components/component-bind/index.js +24 -0
  49. data/vendor/components/indefinido-indemma/components/component-jquery/component.json +14 -0
  50. data/vendor/components/indefinido-indemma/components/component-jquery/index.js +9601 -0
  51. data/vendor/components/indefinido-indemma/components/component-type/component.json +18 -0
  52. data/vendor/components/indefinido-indemma/components/component-type/index.js +32 -0
  53. data/vendor/components/indefinido-indemma/components/indefinido-advisable/component.json +21 -0
  54. data/vendor/components/indefinido-indemma/components/indefinido-advisable/index.js +1 -0
  55. data/vendor/components/indefinido-indemma/components/indefinido-advisable/lib/advisable.js +60 -0
  56. data/vendor/components/indefinido-indemma/components/indefinido-observable/component.json +25 -0
  57. data/vendor/components/indefinido-indemma/components/indefinido-observable/components/cjohansen-sinon/sinon.js +4290 -0
  58. data/vendor/components/indefinido-indemma/components/indefinido-observable/index.js +1 -0
  59. data/vendor/components/indefinido-indemma/components/indefinido-observable/lib/adapters/rivets.js +26 -0
  60. data/vendor/components/indefinido-indemma/components/indefinido-observable/lib/observable.js +323 -0
  61. data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/accessors-legacy.js +92 -0
  62. data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/accessors.js +173 -0
  63. data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/array.indexOf.js +8 -0
  64. data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/object.create.js +77 -0
  65. data/vendor/components/indefinido-indemma/components/kapit-observe-utils/component.json +13 -0
  66. data/vendor/components/indefinido-indemma/components/paulmillr-es6-shim/component.json +17 -0
  67. data/vendor/components/indefinido-indemma/components/paulmillr-es6-shim/es6-shim.js +996 -0
  68. data/vendor/components/indefinido-indemma/components/pluma-assimilate/component.json +25 -0
  69. data/vendor/components/indefinido-indemma/components/pluma-assimilate/dist/assimilate.js +127 -0
  70. data/vendor/components/indefinido-indemma/karma.conf.js +86 -0
  71. data/vendor/components/indefinido-indemma/lib/record/associable.js +229 -82
  72. data/vendor/components/indefinido-indemma/lib/record/errors.js +1 -0
  73. data/vendor/components/indefinido-indemma/lib/record/persistable.js +32 -0
  74. data/vendor/components/indefinido-indemma/lib/record/queryable.js +32 -0
  75. data/vendor/components/indefinido-indemma/lib/record/resource.js +12 -4
  76. data/vendor/components/indefinido-indemma/lib/record/rest.js +1 -1
  77. data/vendor/components/indefinido-indemma/lib/record/restfulable.js +38 -27
  78. data/vendor/components/indefinido-indemma/lib/record/scopable.js +15 -2
  79. data/vendor/components/indefinido-indemma/lib/record/storable.js +48 -0
  80. data/vendor/components/indefinido-indemma/lib/record/validatable.js +10 -5
  81. data/vendor/components/indefinido-indemma/lib/record/validations/cpf.js +1 -1
  82. data/vendor/components/indefinido-indemma/lib/record.js +15 -12
  83. data/vendor/components/indefinido-indemma/spec/record/associable_spec.js +137 -0
  84. data/vendor/components/indefinido-indemma/spec/record/persistable_spec.js +36 -0
  85. data/vendor/components/indefinido-indemma/spec/record/queryable_spec.js +33 -0
  86. data/vendor/components/indefinido-indemma/spec/record/resource_spec.js +93 -0
  87. data/vendor/components/indefinido-indemma/spec/record/rest_spec.js +32 -0
  88. data/vendor/components/indefinido-indemma/spec/record/restfulable_spec.js +288 -0
  89. data/vendor/components/indefinido-indemma/spec/record/scopable_spec.js +212 -0
  90. data/vendor/components/indefinido-indemma/spec/record/storable_spec.js +53 -0
  91. data/vendor/components/indefinido-indemma/spec/record/translationable.js +28 -0
  92. data/vendor/components/indefinido-indemma/spec/record/validatable_spec.js +111 -0
  93. data/vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js +43 -0
  94. data/vendor/components/indefinido-indemma/spec/record/validations/confirmation_spec.js +36 -0
  95. data/vendor/components/indefinido-indemma/spec/record/validations/cpf_spec.js +35 -0
  96. data/vendor/components/indefinido-indemma/spec/record/validations/presence_spec.js +28 -0
  97. data/vendor/components/indefinido-indemma/spec/record/validations/remote_spec.js +87 -0
  98. data/vendor/components/indefinido-indemma/spec/record/validations/type_spec.js +48 -0
  99. data/vendor/components/indefinido-indemma/spec/record_spec.js +37 -0
  100. data/vendor/components/indefinido-indemma/spec/spec_helper.js +11 -0
  101. data/vendor/components/indefinido-indemma/spec/support/value_objects/phone.js +45 -0
  102. data/vendor/components/indefinido-indemma/src/lib/extensions/rivets.coffee +17 -0
  103. data/vendor/components/indefinido-indemma/src/lib/record/associable.coffee +342 -0
  104. data/vendor/components/indefinido-indemma/src/lib/record/errors.coffee +20 -0
  105. data/vendor/components/indefinido-indemma/src/lib/record/maid.coffee +16 -0
  106. data/vendor/components/indefinido-indemma/src/lib/record/persistable.coffee +27 -0
  107. data/vendor/components/indefinido-indemma/src/lib/record/queryable.coffee +29 -0
  108. data/vendor/components/indefinido-indemma/src/lib/record/resource.coffee +106 -0
  109. data/vendor/components/indefinido-indemma/src/lib/record/rest.coffee +28 -0
  110. data/vendor/components/indefinido-indemma/src/lib/record/restfulable.coffee +348 -0
  111. data/vendor/components/indefinido-indemma/src/lib/record/scopable.coffee +275 -0
  112. data/vendor/components/indefinido-indemma/src/lib/record/storable.coffee +46 -0
  113. data/vendor/components/indefinido-indemma/src/lib/record/translationable.coffee +18 -0
  114. data/vendor/components/indefinido-indemma/src/lib/record/validatable.coffee +217 -0
  115. data/vendor/components/indefinido-indemma/src/lib/record/validations/associated.coffee +32 -0
  116. data/vendor/components/indefinido-indemma/src/lib/record/validations/confirmation.coffee +19 -0
  117. data/vendor/components/indefinido-indemma/src/lib/record/validations/cpf.coffee +58 -0
  118. data/vendor/components/indefinido-indemma/src/lib/record/validations/presence.coffee +19 -0
  119. data/vendor/components/indefinido-indemma/src/lib/record/validations/remote.coffee +65 -0
  120. data/vendor/components/indefinido-indemma/src/lib/record/validations/type.coffee +32 -0
  121. data/vendor/components/indefinido-indemma/src/lib/record.coffee +136 -0
  122. data/vendor/components/indefinido-indemma/src/spec/record/associable_spec.coffee +130 -0
  123. data/vendor/components/indefinido-indemma/src/spec/record/persistable_spec.coffee +30 -0
  124. data/vendor/components/indefinido-indemma/src/spec/record/queryable_spec.coffee +27 -0
  125. data/vendor/components/indefinido-indemma/src/spec/record/resource_spec.coffee +69 -0
  126. data/vendor/components/indefinido-indemma/src/spec/record/rest_spec.coffee +22 -0
  127. data/vendor/components/indefinido-indemma/src/spec/record/restfulable_spec.coffee +207 -0
  128. data/vendor/components/indefinido-indemma/src/spec/record/scopable_spec.coffee +191 -0
  129. data/vendor/components/indefinido-indemma/src/spec/record/storable_spec.coffee +40 -0
  130. data/vendor/components/indefinido-indemma/src/spec/record/translationable.coffee +19 -0
  131. data/vendor/components/indefinido-indemma/src/spec/record/validatable_spec.coffee +100 -0
  132. data/vendor/components/indefinido-indemma/src/spec/record/validations/associated_spec.coffee +35 -0
  133. data/vendor/components/indefinido-indemma/src/spec/record/validations/confirmation_spec.coffee +25 -0
  134. data/vendor/components/indefinido-indemma/src/spec/record/validations/cpf_spec.coffee +28 -0
  135. data/vendor/components/indefinido-indemma/src/spec/record/validations/presence_spec.coffee +24 -0
  136. data/vendor/components/indefinido-indemma/src/spec/record/validations/remote_spec.coffee +74 -0
  137. data/vendor/components/indefinido-indemma/src/spec/record/validations/type_spec.coffee +33 -0
  138. data/vendor/components/indefinido-indemma/src/spec/record_spec.coffee +23 -0
  139. data/vendor/components/indefinido-indemma/src/spec/spec_helper.coffee +9 -0
  140. data/vendor/components/indefinido-indemma/src/spec/support/value_objects/phone.coffee +30 -0
  141. data/vendor/components/indefinido-indemma/vendor/object/mixin.js +196 -0
  142. data/vendor/components/indefinido-indemma/vendor/owl/pluralize.js +190 -0
  143. metadata +130 -2
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * chai
3
+ * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
4
+ * MIT Licensed
5
+ */
6
+
7
+ module.exports = function (chai, util) {
8
+ chai.expect = function (val, message) {
9
+ return new chai.Assertion(val, message);
10
+ };
11
+ };
12
+
@@ -0,0 +1,76 @@
1
+ /*!
2
+ * chai
3
+ * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
4
+ * MIT Licensed
5
+ */
6
+
7
+ module.exports = function (chai, util) {
8
+ var Assertion = chai.Assertion;
9
+
10
+ function loadShould () {
11
+ // modify Object.prototype to have `should`
12
+ Object.defineProperty(Object.prototype, 'should',
13
+ {
14
+ set: function (value) {
15
+ // See https://github.com/chaijs/chai/issues/86: this makes
16
+ // `whatever.should = someValue` actually set `someValue`, which is
17
+ // especially useful for `global.should = require('chai').should()`.
18
+ //
19
+ // Note that we have to use [[DefineProperty]] instead of [[Put]]
20
+ // since otherwise we would trigger this very setter!
21
+ Object.defineProperty(this, 'should', {
22
+ value: value,
23
+ enumerable: true,
24
+ configurable: true,
25
+ writable: true
26
+ });
27
+ }
28
+ , get: function(){
29
+ if (this instanceof String || this instanceof Number) {
30
+ return new Assertion(this.constructor(this));
31
+ } else if (this instanceof Boolean) {
32
+ return new Assertion(this == true);
33
+ }
34
+ return new Assertion(this);
35
+ }
36
+ , configurable: true
37
+ });
38
+
39
+ var should = {};
40
+
41
+ should.equal = function (val1, val2, msg) {
42
+ new Assertion(val1, msg).to.equal(val2);
43
+ };
44
+
45
+ should.Throw = function (fn, errt, errs, msg) {
46
+ new Assertion(fn, msg).to.Throw(errt, errs);
47
+ };
48
+
49
+ should.exist = function (val, msg) {
50
+ new Assertion(val, msg).to.exist;
51
+ }
52
+
53
+ // negation
54
+ should.not = {}
55
+
56
+ should.not.equal = function (val1, val2, msg) {
57
+ new Assertion(val1, msg).to.not.equal(val2);
58
+ };
59
+
60
+ should.not.Throw = function (fn, errt, errs, msg) {
61
+ new Assertion(fn, msg).to.not.Throw(errt, errs);
62
+ };
63
+
64
+ should.not.exist = function (val, msg) {
65
+ new Assertion(val, msg).to.not.exist;
66
+ }
67
+
68
+ should['throw'] = should['Throw'];
69
+ should.not['throw'] = should.not['Throw'];
70
+
71
+ return should;
72
+ };
73
+
74
+ chai.should = loadShould;
75
+ chai.Should = loadShould;
76
+ };
@@ -0,0 +1,94 @@
1
+ /*!
2
+ * Chai - addChainingMethod utility
3
+ * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4
+ * MIT Licensed
5
+ */
6
+
7
+ /*!
8
+ * Module dependencies
9
+ */
10
+
11
+ var transferFlags = require('./transferFlags');
12
+
13
+ /*!
14
+ * Module variables
15
+ */
16
+
17
+ // Check whether `__proto__` is supported
18
+ var hasProtoSupport = '__proto__' in Object;
19
+
20
+ // Without `__proto__` support, this module will need to add properties to a function.
21
+ // However, some Function.prototype methods cannot be overwritten,
22
+ // and there seems no easy cross-platform way to detect them (@see chaijs/chai/issues/69).
23
+ var excludeNames = /^(?:length|name|arguments|caller)$/;
24
+
25
+ // Cache `Function` properties
26
+ var call = Function.prototype.call,
27
+ apply = Function.prototype.apply;
28
+
29
+ /**
30
+ * ### addChainableMethod (ctx, name, method, chainingBehavior)
31
+ *
32
+ * Adds a method to an object, such that the method can also be chained.
33
+ *
34
+ * utils.addChainableMethod(chai.Assertion.prototype, 'foo', function (str) {
35
+ * var obj = utils.flag(this, 'object');
36
+ * new chai.Assertion(obj).to.be.equal(str);
37
+ * });
38
+ *
39
+ * Can also be accessed directly from `chai.Assertion`.
40
+ *
41
+ * chai.Assertion.addChainableMethod('foo', fn, chainingBehavior);
42
+ *
43
+ * The result can then be used as both a method assertion, executing both `method` and
44
+ * `chainingBehavior`, or as a language chain, which only executes `chainingBehavior`.
45
+ *
46
+ * expect(fooStr).to.be.foo('bar');
47
+ * expect(fooStr).to.be.foo.equal('foo');
48
+ *
49
+ * @param {Object} ctx object to which the method is added
50
+ * @param {String} name of method to add
51
+ * @param {Function} method function to be used for `name`, when called
52
+ * @param {Function} chainingBehavior function to be called every time the property is accessed
53
+ * @name addChainableMethod
54
+ * @api public
55
+ */
56
+
57
+ module.exports = function (ctx, name, method, chainingBehavior) {
58
+ if (typeof chainingBehavior !== 'function')
59
+ chainingBehavior = function () { };
60
+
61
+ Object.defineProperty(ctx, name,
62
+ { get: function () {
63
+ chainingBehavior.call(this);
64
+
65
+ var assert = function () {
66
+ var result = method.apply(this, arguments);
67
+ return result === undefined ? this : result;
68
+ };
69
+
70
+ // Use `__proto__` if available
71
+ if (hasProtoSupport) {
72
+ // Inherit all properties from the object by replacing the `Function` prototype
73
+ var prototype = assert.__proto__ = Object.create(this);
74
+ // Restore the `call` and `apply` methods from `Function`
75
+ prototype.call = call;
76
+ prototype.apply = apply;
77
+ }
78
+ // Otherwise, redefine all properties (slow!)
79
+ else {
80
+ var asserterNames = Object.getOwnPropertyNames(ctx);
81
+ asserterNames.forEach(function (asserterName) {
82
+ if (!excludeNames.test(asserterName)) {
83
+ var pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
84
+ Object.defineProperty(assert, asserterName, pd);
85
+ }
86
+ });
87
+ }
88
+
89
+ transferFlags(this, assert);
90
+ return assert;
91
+ }
92
+ , configurable: true
93
+ });
94
+ };
@@ -0,0 +1,37 @@
1
+ /*!
2
+ * Chai - addMethod utility
3
+ * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4
+ * MIT Licensed
5
+ */
6
+
7
+ /**
8
+ * ### .addMethod (ctx, name, method)
9
+ *
10
+ * Adds a method to the prototype of an object.
11
+ *
12
+ * utils.addMethod(chai.Assertion.prototype, 'foo', function (str) {
13
+ * var obj = utils.flag(this, 'object');
14
+ * new chai.Assertion(obj).to.be.equal(str);
15
+ * });
16
+ *
17
+ * Can also be accessed directly from `chai.Assertion`.
18
+ *
19
+ * chai.Assertion.addMethod('foo', fn);
20
+ *
21
+ * Then can be used as any other assertion.
22
+ *
23
+ * expect(fooStr).to.be.foo('bar');
24
+ *
25
+ * @param {Object} ctx object to which the method is added
26
+ * @param {String} name of method to add
27
+ * @param {Function} method function to be used for name
28
+ * @name addMethod
29
+ * @api public
30
+ */
31
+
32
+ module.exports = function (ctx, name, method) {
33
+ ctx[name] = function () {
34
+ var result = method.apply(this, arguments);
35
+ return result === undefined ? this : result;
36
+ };
37
+ };
@@ -0,0 +1,40 @@
1
+ /*!
2
+ * Chai - addProperty utility
3
+ * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4
+ * MIT Licensed
5
+ */
6
+
7
+ /**
8
+ * ### addProperty (ctx, name, getter)
9
+ *
10
+ * Adds a property to the prototype of an object.
11
+ *
12
+ * utils.addProperty(chai.Assertion.prototype, 'foo', function () {
13
+ * var obj = utils.flag(this, 'object');
14
+ * new chai.Assertion(obj).to.be.instanceof(Foo);
15
+ * });
16
+ *
17
+ * Can also be accessed directly from `chai.Assertion`.
18
+ *
19
+ * chai.Assertion.addProperty('foo', fn);
20
+ *
21
+ * Then can be used as any other assertion.
22
+ *
23
+ * expect(myFoo).to.be.foo;
24
+ *
25
+ * @param {Object} ctx object to which the property is added
26
+ * @param {String} name of property to add
27
+ * @param {Function} getter function to be used for name
28
+ * @name addProperty
29
+ * @api public
30
+ */
31
+
32
+ module.exports = function (ctx, name, getter) {
33
+ Object.defineProperty(ctx, name,
34
+ { get: function () {
35
+ var result = getter.call(this);
36
+ return result === undefined ? this : result;
37
+ }
38
+ , configurable: true
39
+ });
40
+ };
@@ -0,0 +1,129 @@
1
+ // This is (almost) directly from Node.js assert
2
+ // https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/assert.js
3
+
4
+ module.exports = _deepEqual;
5
+
6
+ var getEnumerableProperties = require('./getEnumerableProperties');
7
+
8
+ // for the browser
9
+ var Buffer;
10
+ try {
11
+ Buffer = require('buffer').Buffer;
12
+ } catch (ex) {
13
+ Buffer = {
14
+ isBuffer: function () { return false; }
15
+ };
16
+ }
17
+
18
+ function _deepEqual(actual, expected, memos) {
19
+
20
+ // 7.1. All identical values are equivalent, as determined by ===.
21
+ if (actual === expected) {
22
+ return true;
23
+
24
+ } else if (Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) {
25
+ if (actual.length != expected.length) return false;
26
+
27
+ for (var i = 0; i < actual.length; i++) {
28
+ if (actual[i] !== expected[i]) return false;
29
+ }
30
+
31
+ return true;
32
+
33
+ // 7.2. If the expected value is a Date object, the actual value is
34
+ // equivalent if it is also a Date object that refers to the same time.
35
+ } else if (expected instanceof Date) {
36
+ if (!(actual instanceof Date)) return false;
37
+ return actual.getTime() === expected.getTime();
38
+
39
+ // 7.3. Other pairs that do not both pass typeof value == 'object',
40
+ // equivalence is determined by ==.
41
+ } else if (typeof actual != 'object' && typeof expected != 'object') {
42
+ return actual === expected;
43
+
44
+ } else if (expected instanceof RegExp) {
45
+ if (!(actual instanceof RegExp)) return false;
46
+ return actual.toString() === expected.toString();
47
+
48
+ // 7.4. For all other Object pairs, including Array objects, equivalence is
49
+ // determined by having the same number of owned properties (as verified
50
+ // with Object.prototype.hasOwnProperty.call), the same set of keys
51
+ // (although not necessarily the same order), equivalent values for every
52
+ // corresponding key, and an identical 'prototype' property. Note: this
53
+ // accounts for both named and indexed properties on Arrays.
54
+ } else {
55
+ return objEquiv(actual, expected, memos);
56
+ }
57
+ }
58
+
59
+ function isUndefinedOrNull(value) {
60
+ return value === null || value === undefined;
61
+ }
62
+
63
+ function isArguments(object) {
64
+ return Object.prototype.toString.call(object) == '[object Arguments]';
65
+ }
66
+
67
+ function objEquiv(a, b, memos) {
68
+ if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
69
+ return false;
70
+
71
+ // an identical 'prototype' property.
72
+ if (a.prototype !== b.prototype) return false;
73
+
74
+ // check if we have already compared a and b
75
+ var i;
76
+ if (memos) {
77
+ for(i = 0; i < memos.length; i++) {
78
+ if ((memos[i][0] === a && memos[i][1] === b) ||
79
+ (memos[i][0] === b && memos[i][1] === a))
80
+ return true;
81
+ }
82
+ } else {
83
+ memos = [];
84
+ }
85
+
86
+ //~~~I've managed to break Object.keys through screwy arguments passing.
87
+ // Converting to array solves the problem.
88
+ if (isArguments(a)) {
89
+ if (!isArguments(b)) {
90
+ return false;
91
+ }
92
+ a = pSlice.call(a);
93
+ b = pSlice.call(b);
94
+ return _deepEqual(a, b, memos);
95
+ }
96
+ try {
97
+ var ka = getEnumerableProperties(a),
98
+ kb = getEnumerableProperties(b),
99
+ key;
100
+ } catch (e) {//happens when one is a string literal and the other isn't
101
+ return false;
102
+ }
103
+
104
+ // having the same number of owned properties (keys incorporates
105
+ // hasOwnProperty)
106
+ if (ka.length != kb.length)
107
+ return false;
108
+
109
+ //the same set of keys (although not necessarily the same order),
110
+ ka.sort();
111
+ kb.sort();
112
+ //~~~cheap key test
113
+ for (i = ka.length - 1; i >= 0; i--) {
114
+ if (ka[i] != kb[i])
115
+ return false;
116
+ }
117
+
118
+ // remember objects we have compared to guard against circular references
119
+ memos.push([ a, b ]);
120
+
121
+ //equivalent values for every corresponding key, and
122
+ //~~~possibly expensive deep test
123
+ for (i = ka.length - 1; i >= 0; i--) {
124
+ key = ka[i];
125
+ if (!_deepEqual(a[key], b[key], memos)) return false;
126
+ }
127
+
128
+ return true;
129
+ }
@@ -0,0 +1,32 @@
1
+ /*!
2
+ * Chai - flag utility
3
+ * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4
+ * MIT Licensed
5
+ */
6
+
7
+ /**
8
+ * ### flag(object ,key, [value])
9
+ *
10
+ * Get or set a flag value on an object. If a
11
+ * value is provided it will be set, else it will
12
+ * return the currently set value or `undefined` if
13
+ * the value is not set.
14
+ *
15
+ * utils.flag(this, 'foo', 'bar'); // setter
16
+ * utils.flag(this, 'foo'); // getter, returns `bar`
17
+ *
18
+ * @param {Object} object (constructed Assertion
19
+ * @param {String} key
20
+ * @param {Mixed} value (optional)
21
+ * @name flag
22
+ * @api private
23
+ */
24
+
25
+ module.exports = function (obj, key, value) {
26
+ var flags = obj.__flags || (obj.__flags = Object.create(null));
27
+ if (arguments.length === 3) {
28
+ flags[key] = value;
29
+ } else {
30
+ return flags[key];
31
+ }
32
+ };
@@ -0,0 +1,19 @@
1
+ /*!
2
+ * Chai - getActual utility
3
+ * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4
+ * MIT Licensed
5
+ */
6
+
7
+ /**
8
+ * # getActual(object, [actual])
9
+ *
10
+ * Returns the `actual` value for an Assertion
11
+ *
12
+ * @param {Object} object (constructed Assertion)
13
+ * @param {Arguments} chai.Assertion.prototype.assert arguments
14
+ */
15
+
16
+ module.exports = function (obj, args) {
17
+ var actual = args[4];
18
+ return 'undefined' !== typeof actual ? actual : obj._obj;
19
+ };
@@ -0,0 +1,25 @@
1
+ /*!
2
+ * Chai - getEnumerableProperties utility
3
+ * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4
+ * MIT Licensed
5
+ */
6
+
7
+ /**
8
+ * ### .getEnumerableProperties(object)
9
+ *
10
+ * This allows the retrieval of enumerable property names of an object,
11
+ * inherited or not.
12
+ *
13
+ * @param {Object} object
14
+ * @returns {Array}
15
+ * @name getEnumerableProperties
16
+ * @api public
17
+ */
18
+
19
+ module.exports = function getEnumerableProperties(object) {
20
+ var result = [];
21
+ for (var name in object) {
22
+ result.push(name);
23
+ }
24
+ return result;
25
+ };
@@ -0,0 +1,49 @@
1
+ /*!
2
+ * Chai - message composition utility
3
+ * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4
+ * MIT Licensed
5
+ */
6
+
7
+ /*!
8
+ * Module dependancies
9
+ */
10
+
11
+ var flag = require('./flag')
12
+ , getActual = require('./getActual')
13
+ , inspect = require('./inspect')
14
+ , objDisplay = require('./objDisplay');
15
+
16
+ /**
17
+ * ### .getMessage(object, message, negateMessage)
18
+ *
19
+ * Construct the error message based on flags
20
+ * and template tags. Template tags will return
21
+ * a stringified inspection of the object referenced.
22
+ *
23
+ * Message template tags:
24
+ * - `#{this}` current asserted object
25
+ * - `#{act}` actual value
26
+ * - `#{exp}` expected value
27
+ *
28
+ * @param {Object} object (constructed Assertion)
29
+ * @param {Arguments} chai.Assertion.prototype.assert arguments
30
+ * @name getMessage
31
+ * @api public
32
+ */
33
+
34
+ module.exports = function (obj, args) {
35
+ var negate = flag(obj, 'negate')
36
+ , val = flag(obj, 'object')
37
+ , expected = args[3]
38
+ , actual = getActual(obj, args)
39
+ , msg = negate ? args[2] : args[1]
40
+ , flagMsg = flag(obj, 'message');
41
+
42
+ msg = msg || '';
43
+ msg = msg
44
+ .replace(/#{this}/g, objDisplay(val))
45
+ .replace(/#{act}/g, objDisplay(actual))
46
+ .replace(/#{exp}/g, objDisplay(expected));
47
+
48
+ return flagMsg ? flagMsg + ': ' + msg : msg;
49
+ };
@@ -0,0 +1,20 @@
1
+ /*!
2
+ * Chai - getName utility
3
+ * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4
+ * MIT Licensed
5
+ */
6
+
7
+ /**
8
+ * # getName(func)
9
+ *
10
+ * Gets the name of a function, in a cross-browser way.
11
+ *
12
+ * @param {Function} a function (usually a constructor)
13
+ */
14
+
15
+ module.exports = function (func) {
16
+ if (func.name) return func.name;
17
+
18
+ var match = /^\s?function ([^(]*)\(/.exec(func);
19
+ return match && match[1] ? match[1] : "";
20
+ };
@@ -0,0 +1,102 @@
1
+ /*!
2
+ * Chai - getPathValue utility
3
+ * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4
+ * @see https://github.com/logicalparadox/filtr
5
+ * MIT Licensed
6
+ */
7
+
8
+ /**
9
+ * ### .getPathValue(path, object)
10
+ *
11
+ * This allows the retrieval of values in an
12
+ * object given a string path.
13
+ *
14
+ * var obj = {
15
+ * prop1: {
16
+ * arr: ['a', 'b', 'c']
17
+ * , str: 'Hello'
18
+ * }
19
+ * , prop2: {
20
+ * arr: [ { nested: 'Universe' } ]
21
+ * , str: 'Hello again!'
22
+ * }
23
+ * }
24
+ *
25
+ * The following would be the results.
26
+ *
27
+ * getPathValue('prop1.str', obj); // Hello
28
+ * getPathValue('prop1.att[2]', obj); // b
29
+ * getPathValue('prop2.arr[0].nested', obj); // Universe
30
+ *
31
+ * @param {String} path
32
+ * @param {Object} object
33
+ * @returns {Object} value or `undefined`
34
+ * @name getPathValue
35
+ * @api public
36
+ */
37
+
38
+ var getPathValue = module.exports = function (path, obj) {
39
+ var parsed = parsePath(path);
40
+ return _getPathValue(parsed, obj);
41
+ };
42
+
43
+ /*!
44
+ * ## parsePath(path)
45
+ *
46
+ * Helper function used to parse string object
47
+ * paths. Use in conjunction with `_getPathValue`.
48
+ *
49
+ * var parsed = parsePath('myobject.property.subprop');
50
+ *
51
+ * ### Paths:
52
+ *
53
+ * * Can be as near infinitely deep and nested
54
+ * * Arrays are also valid using the formal `myobject.document[3].property`.
55
+ *
56
+ * @param {String} path
57
+ * @returns {Object} parsed
58
+ * @api private
59
+ */
60
+
61
+ function parsePath (path) {
62
+ var str = path.replace(/\[/g, '.[')
63
+ , parts = str.match(/(\\\.|[^.]+?)+/g);
64
+ return parts.map(function (value) {
65
+ var re = /\[(\d+)\]$/
66
+ , mArr = re.exec(value)
67
+ if (mArr) return { i: parseFloat(mArr[1]) };
68
+ else return { p: value };
69
+ });
70
+ };
71
+
72
+ /*!
73
+ * ## _getPathValue(parsed, obj)
74
+ *
75
+ * Helper companion function for `.parsePath` that returns
76
+ * the value located at the parsed address.
77
+ *
78
+ * var value = getPathValue(parsed, obj);
79
+ *
80
+ * @param {Object} parsed definition from `parsePath`.
81
+ * @param {Object} object to search against
82
+ * @returns {Object|Undefined} value
83
+ * @api private
84
+ */
85
+
86
+ function _getPathValue (parsed, obj) {
87
+ var tmp = obj
88
+ , res;
89
+ for (var i = 0, l = parsed.length; i < l; i++) {
90
+ var part = parsed[i];
91
+ if (tmp) {
92
+ if ('undefined' !== typeof part.p)
93
+ tmp = tmp[part.p];
94
+ else if ('undefined' !== typeof part.i)
95
+ tmp = tmp[part.i];
96
+ if (i == (l - 1)) res = tmp;
97
+ } else {
98
+ res = undefined;
99
+ }
100
+ }
101
+ return res;
102
+ };
@@ -0,0 +1,35 @@
1
+ /*!
2
+ * Chai - getProperties utility
3
+ * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4
+ * MIT Licensed
5
+ */
6
+
7
+ /**
8
+ * ### .getProperties(object)
9
+ *
10
+ * This allows the retrieval of property names of an object, enumerable or not,
11
+ * inherited or not.
12
+ *
13
+ * @param {Object} object
14
+ * @returns {Array}
15
+ * @name getProperties
16
+ * @api public
17
+ */
18
+
19
+ module.exports = function getProperties(object) {
20
+ var result = Object.getOwnPropertyNames(subject);
21
+
22
+ function addProperty(property) {
23
+ if (result.indexOf(property) === -1) {
24
+ result.push(property);
25
+ }
26
+ }
27
+
28
+ var proto = Object.getPrototypeOf(subject);
29
+ while (proto !== null) {
30
+ Object.getOwnPropertyNames(proto).forEach(addProperty);
31
+ proto = Object.getPrototypeOf(proto);
32
+ }
33
+
34
+ return result;
35
+ };