ende 0.4.5 → 0.4.6
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.
- checksums.yaml +4 -4
- data/lib/assets/javascripts/aura/extensions/devise.js.coffee +0 -2
- data/lib/assets/javascripts/aura/extensions/platform.js.coffee +3 -0
- data/lib/assets/javascripts/aura/extensions/rivets.js.coffee +17 -1
- data/lib/assets/javascripts/aura/extensions/routes.js.coffee +8 -7
- data/lib/assets/javascripts/aura/extensions/states.js.coffee +13 -1
- data/lib/assets/javascripts/aura/extensions/widget/eventable.js.coffee +4 -2
- data/lib/assets/javascripts/config/load_components.js.coffee +19 -12
- data/lib/assets/javascripts/ende.js.coffee +33 -12
- data/lib/ende/version.rb +1 -1
- data/vendor/assets/components/build.css +111 -0
- data/vendor/assets/components/ende_build.js +160 -41
- data/vendor/components/indefinido-indemma/build/development.js +3 -118
- data/vendor/components/indefinido-indemma/build/release.js +39 -4170
- data/vendor/components/indefinido-indemma/build/test.js +3 -118
- data/vendor/components/indefinido-indemma/lib/record/associable.js +10 -2
- data/vendor/components/indefinido-indemma/lib/record/restfulable.js +26 -15
- data/vendor/components/indefinido-indemma/lib/record.js +3 -1
- data/vendor/components/indefinido-indemma/src/lib/record/associable.coffee +15 -1
- data/vendor/components/indefinido-indemma/src/lib/record/restfulable.coffee +37 -12
- data/vendor/components/indefinido-indemma/src/lib/record.coffee +3 -1
- data/vendor/components/indefinido-observable/.gitignore +15 -0
- data/vendor/components/indefinido-observable/.ruby-gemset +1 -0
- data/vendor/components/indefinido-observable/.ruby-version +1 -0
- data/vendor/components/indefinido-observable/Gemfile +13 -0
- data/vendor/components/indefinido-observable/Guardfile +39 -0
- data/vendor/components/indefinido-observable/History.md +0 -0
- data/vendor/components/indefinido-observable/Readme.md +116 -0
- data/vendor/components/indefinido-observable/build/build.js +14798 -0
- data/vendor/components/indefinido-observable/build/development.js +339 -0
- data/vendor/components/indefinido-observable/build/release.js +14937 -0
- data/vendor/components/indefinido-observable/build/test.js +339 -0
- data/vendor/components/indefinido-observable/component.json +5 -1
- data/vendor/components/indefinido-observable/components/chaijs-chai/component.json +46 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/index.js +1 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/assertion.js +132 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/core/assertions.js +1270 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/error.js +60 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/interface/assert.js +1060 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/interface/expect.js +12 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/interface/should.js +76 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +94 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/addMethod.js +37 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/addProperty.js +40 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/eql.js +124 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/flag.js +32 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getActual.js +19 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +25 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getMessage.js +49 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getName.js +20 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getPathValue.js +102 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getProperties.js +35 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/index.js +108 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/inspect.js +316 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/objDisplay.js +48 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +51 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +54 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/test.js +26 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/transferFlags.js +44 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/type.js +45 -0
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai.js +79 -0
- data/vendor/components/indefinido-observable/components/component-jquery/component.json +14 -0
- data/vendor/components/indefinido-observable/components/component-jquery/index.js +9601 -0
- data/vendor/components/indefinido-observable/components/kapit-observe-shim/component.json +11 -0
- data/vendor/components/indefinido-observable/components/kapit-observe-utils/component.json +13 -0
- data/vendor/components/indefinido-observable/karma.conf.js +92 -0
- data/vendor/components/indefinido-observable/lib/adapters/rivets.js +3 -1
- data/vendor/components/indefinido-observable/lib/observable.js +47 -13
- data/vendor/components/indefinido-observable/spec/legacy/observable_spec.js +126 -0
- data/vendor/components/indefinido-observable/spec/observable_spec.js +92 -0
- data/vendor/components/indefinido-observable/spec/spec_helper.js +8 -0
- data/vendor/components/indefinido-observable/spec/vendor/accessors_spec.js +63 -0
- data/vendor/components/indefinido-observable/src/lib/adapters/rivets.js.coffee +15 -0
- data/vendor/components/indefinido-observable/src/spec/legacy/observable_spec.coffee +132 -0
- data/vendor/components/indefinido-observable/src/spec/observable_spec.coffee +85 -0
- data/vendor/components/indefinido-observable/src/spec/spec_helper.coffee +5 -0
- data/vendor/components/indefinido-observable/src/spec/vendor/accessors_spec.coffee +59 -0
- data/vendor/components/indefinido-observable/vendor/shims/accessors.js +71 -9
- data/vendor/components/indefinido-observable/vendor/spec/boot.js +104 -0
- data/vendor/components/indefinido-observable/vendor/spec/jasmine.js +2054 -0
- metadata +58 -2
@@ -0,0 +1,108 @@
|
|
1
|
+
/*!
|
2
|
+
* chai
|
3
|
+
* Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>
|
4
|
+
* MIT Licensed
|
5
|
+
*/
|
6
|
+
|
7
|
+
/*!
|
8
|
+
* Main exports
|
9
|
+
*/
|
10
|
+
|
11
|
+
var exports = module.exports = {};
|
12
|
+
|
13
|
+
/*!
|
14
|
+
* test utility
|
15
|
+
*/
|
16
|
+
|
17
|
+
exports.test = require('./test');
|
18
|
+
|
19
|
+
/*!
|
20
|
+
* type utility
|
21
|
+
*/
|
22
|
+
|
23
|
+
exports.type = require('./type');
|
24
|
+
|
25
|
+
/*!
|
26
|
+
* message utility
|
27
|
+
*/
|
28
|
+
|
29
|
+
exports.getMessage = require('./getMessage');
|
30
|
+
|
31
|
+
/*!
|
32
|
+
* actual utility
|
33
|
+
*/
|
34
|
+
|
35
|
+
exports.getActual = require('./getActual');
|
36
|
+
|
37
|
+
/*!
|
38
|
+
* Inspect util
|
39
|
+
*/
|
40
|
+
|
41
|
+
exports.inspect = require('./inspect');
|
42
|
+
|
43
|
+
/*!
|
44
|
+
* Object Display util
|
45
|
+
*/
|
46
|
+
|
47
|
+
exports.objDisplay = require('./objDisplay');
|
48
|
+
|
49
|
+
/*!
|
50
|
+
* Flag utility
|
51
|
+
*/
|
52
|
+
|
53
|
+
exports.flag = require('./flag');
|
54
|
+
|
55
|
+
/*!
|
56
|
+
* Flag transferring utility
|
57
|
+
*/
|
58
|
+
|
59
|
+
exports.transferFlags = require('./transferFlags');
|
60
|
+
|
61
|
+
/*!
|
62
|
+
* Deep equal utility
|
63
|
+
*/
|
64
|
+
|
65
|
+
exports.eql = require('./eql');
|
66
|
+
|
67
|
+
/*!
|
68
|
+
* Deep path value
|
69
|
+
*/
|
70
|
+
|
71
|
+
exports.getPathValue = require('./getPathValue');
|
72
|
+
|
73
|
+
/*!
|
74
|
+
* Function name
|
75
|
+
*/
|
76
|
+
|
77
|
+
exports.getName = require('./getName');
|
78
|
+
|
79
|
+
/*!
|
80
|
+
* add Property
|
81
|
+
*/
|
82
|
+
|
83
|
+
exports.addProperty = require('./addProperty');
|
84
|
+
|
85
|
+
/*!
|
86
|
+
* add Method
|
87
|
+
*/
|
88
|
+
|
89
|
+
exports.addMethod = require('./addMethod');
|
90
|
+
|
91
|
+
/*!
|
92
|
+
* overwrite Property
|
93
|
+
*/
|
94
|
+
|
95
|
+
exports.overwriteProperty = require('./overwriteProperty');
|
96
|
+
|
97
|
+
/*!
|
98
|
+
* overwrite Method
|
99
|
+
*/
|
100
|
+
|
101
|
+
exports.overwriteMethod = require('./overwriteMethod');
|
102
|
+
|
103
|
+
/*!
|
104
|
+
* Add a chainable method
|
105
|
+
*/
|
106
|
+
|
107
|
+
exports.addChainableMethod = require('./addChainableMethod');
|
108
|
+
|
@@ -0,0 +1,316 @@
|
|
1
|
+
// This is (almost) directly from Node.js utils
|
2
|
+
// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js
|
3
|
+
|
4
|
+
var getName = require('./getName');
|
5
|
+
var getProperties = require('./getProperties');
|
6
|
+
var getEnumerableProperties = require('./getEnumerableProperties');
|
7
|
+
|
8
|
+
module.exports = inspect;
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Echos the value of a value. Trys to print the value out
|
12
|
+
* in the best way possible given the different types.
|
13
|
+
*
|
14
|
+
* @param {Object} obj The object to print out.
|
15
|
+
* @param {Boolean} showHidden Flag that shows hidden (not enumerable)
|
16
|
+
* properties of objects.
|
17
|
+
* @param {Number} depth Depth in which to descend in object. Default is 2.
|
18
|
+
* @param {Boolean} colors Flag to turn on ANSI escape codes to color the
|
19
|
+
* output. Default is false (no coloring).
|
20
|
+
*/
|
21
|
+
function inspect(obj, showHidden, depth, colors) {
|
22
|
+
var ctx = {
|
23
|
+
showHidden: showHidden,
|
24
|
+
seen: [],
|
25
|
+
stylize: function (str) { return str; }
|
26
|
+
};
|
27
|
+
return formatValue(ctx, obj, (typeof depth === 'undefined' ? 2 : depth));
|
28
|
+
}
|
29
|
+
|
30
|
+
// https://gist.github.com/1044128/
|
31
|
+
var getOuterHTML = function(element) {
|
32
|
+
if ('outerHTML' in element) return element.outerHTML;
|
33
|
+
var ns = "http://www.w3.org/1999/xhtml";
|
34
|
+
var container = document.createElementNS(ns, '_');
|
35
|
+
var elemProto = (window.HTMLElement || window.Element).prototype;
|
36
|
+
var xmlSerializer = new XMLSerializer();
|
37
|
+
var html;
|
38
|
+
if (document.xmlVersion) {
|
39
|
+
return xmlSerializer.serializeToString(element);
|
40
|
+
} else {
|
41
|
+
container.appendChild(element.cloneNode(false));
|
42
|
+
html = container.innerHTML.replace('><', '>' + element.innerHTML + '<');
|
43
|
+
container.innerHTML = '';
|
44
|
+
return html;
|
45
|
+
}
|
46
|
+
};
|
47
|
+
|
48
|
+
// Returns true if object is a DOM element.
|
49
|
+
var isDOMElement = function (object) {
|
50
|
+
if (typeof HTMLElement === 'object') {
|
51
|
+
return object instanceof HTMLElement;
|
52
|
+
} else {
|
53
|
+
return object &&
|
54
|
+
typeof object === 'object' &&
|
55
|
+
object.nodeType === 1 &&
|
56
|
+
typeof object.nodeName === 'string';
|
57
|
+
}
|
58
|
+
};
|
59
|
+
|
60
|
+
function formatValue(ctx, value, recurseTimes) {
|
61
|
+
// Provide a hook for user-specified inspect functions.
|
62
|
+
// Check that value is an object with an inspect function on it
|
63
|
+
if (value && typeof value.inspect === 'function' &&
|
64
|
+
// Filter out the util module, it's inspect function is special
|
65
|
+
value.inspect !== exports.inspect &&
|
66
|
+
// Also filter out any prototype objects using the circular check.
|
67
|
+
!(value.constructor && value.constructor.prototype === value)) {
|
68
|
+
return value.inspect(recurseTimes);
|
69
|
+
}
|
70
|
+
|
71
|
+
// Primitive types cannot have properties
|
72
|
+
var primitive = formatPrimitive(ctx, value);
|
73
|
+
if (primitive) {
|
74
|
+
return primitive;
|
75
|
+
}
|
76
|
+
|
77
|
+
// If it's DOM elem, get outer HTML.
|
78
|
+
if (isDOMElement(value)) {
|
79
|
+
return getOuterHTML(value);
|
80
|
+
}
|
81
|
+
|
82
|
+
// Look up the keys of the object.
|
83
|
+
var visibleKeys = getEnumerableProperties(value);
|
84
|
+
var keys = ctx.showHidden ? getProperties(value) : visibleKeys;
|
85
|
+
|
86
|
+
// Some type of object without properties can be shortcutted.
|
87
|
+
// In IE, errors have a single `stack` property, or if they are vanilla `Error`,
|
88
|
+
// a `stack` plus `description` property; ignore those for consistency.
|
89
|
+
if (keys.length === 0 || (isError(value) && (
|
90
|
+
(keys.length === 1 && keys[0] === 'stack') ||
|
91
|
+
(keys.length === 2 && keys[0] === 'description' && keys[1] === 'stack')
|
92
|
+
))) {
|
93
|
+
if (typeof value === 'function') {
|
94
|
+
var name = getName(value);
|
95
|
+
var nameSuffix = name ? ': ' + name : '';
|
96
|
+
return ctx.stylize('[Function' + nameSuffix + ']', 'special');
|
97
|
+
}
|
98
|
+
if (isRegExp(value)) {
|
99
|
+
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
100
|
+
}
|
101
|
+
if (isDate(value)) {
|
102
|
+
return ctx.stylize(Date.prototype.toUTCString.call(value), 'date');
|
103
|
+
}
|
104
|
+
if (isError(value)) {
|
105
|
+
return formatError(value);
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
var base = '', array = false, braces = ['{', '}'];
|
110
|
+
|
111
|
+
// Make Array say that they are Array
|
112
|
+
if (isArray(value)) {
|
113
|
+
array = true;
|
114
|
+
braces = ['[', ']'];
|
115
|
+
}
|
116
|
+
|
117
|
+
// Make functions say that they are functions
|
118
|
+
if (typeof value === 'function') {
|
119
|
+
var name = getName(value);
|
120
|
+
var nameSuffix = name ? ': ' + name : '';
|
121
|
+
base = ' [Function' + nameSuffix + ']';
|
122
|
+
}
|
123
|
+
|
124
|
+
// Make RegExps say that they are RegExps
|
125
|
+
if (isRegExp(value)) {
|
126
|
+
base = ' ' + RegExp.prototype.toString.call(value);
|
127
|
+
}
|
128
|
+
|
129
|
+
// Make dates with properties first say the date
|
130
|
+
if (isDate(value)) {
|
131
|
+
base = ' ' + Date.prototype.toUTCString.call(value);
|
132
|
+
}
|
133
|
+
|
134
|
+
// Make error with message first say the error
|
135
|
+
if (isError(value)) {
|
136
|
+
return formatError(value);
|
137
|
+
}
|
138
|
+
|
139
|
+
if (keys.length === 0 && (!array || value.length == 0)) {
|
140
|
+
return braces[0] + base + braces[1];
|
141
|
+
}
|
142
|
+
|
143
|
+
if (recurseTimes < 0) {
|
144
|
+
if (isRegExp(value)) {
|
145
|
+
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
146
|
+
} else {
|
147
|
+
return ctx.stylize('[Object]', 'special');
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
ctx.seen.push(value);
|
152
|
+
|
153
|
+
var output;
|
154
|
+
if (array) {
|
155
|
+
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
156
|
+
} else {
|
157
|
+
output = keys.map(function(key) {
|
158
|
+
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
159
|
+
});
|
160
|
+
}
|
161
|
+
|
162
|
+
ctx.seen.pop();
|
163
|
+
|
164
|
+
return reduceToSingleString(output, base, braces);
|
165
|
+
}
|
166
|
+
|
167
|
+
|
168
|
+
function formatPrimitive(ctx, value) {
|
169
|
+
switch (typeof value) {
|
170
|
+
case 'undefined':
|
171
|
+
return ctx.stylize('undefined', 'undefined');
|
172
|
+
|
173
|
+
case 'string':
|
174
|
+
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
175
|
+
.replace(/'/g, "\\'")
|
176
|
+
.replace(/\\"/g, '"') + '\'';
|
177
|
+
return ctx.stylize(simple, 'string');
|
178
|
+
|
179
|
+
case 'number':
|
180
|
+
return ctx.stylize('' + value, 'number');
|
181
|
+
|
182
|
+
case 'boolean':
|
183
|
+
return ctx.stylize('' + value, 'boolean');
|
184
|
+
}
|
185
|
+
// For some reason typeof null is "object", so special case here.
|
186
|
+
if (value === null) {
|
187
|
+
return ctx.stylize('null', 'null');
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
191
|
+
|
192
|
+
function formatError(value) {
|
193
|
+
return '[' + Error.prototype.toString.call(value) + ']';
|
194
|
+
}
|
195
|
+
|
196
|
+
|
197
|
+
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
198
|
+
var output = [];
|
199
|
+
for (var i = 0, l = value.length; i < l; ++i) {
|
200
|
+
if (Object.prototype.hasOwnProperty.call(value, String(i))) {
|
201
|
+
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
202
|
+
String(i), true));
|
203
|
+
} else {
|
204
|
+
output.push('');
|
205
|
+
}
|
206
|
+
}
|
207
|
+
keys.forEach(function(key) {
|
208
|
+
if (!key.match(/^\d+$/)) {
|
209
|
+
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
210
|
+
key, true));
|
211
|
+
}
|
212
|
+
});
|
213
|
+
return output;
|
214
|
+
}
|
215
|
+
|
216
|
+
|
217
|
+
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
218
|
+
var name, str;
|
219
|
+
if (value.__lookupGetter__) {
|
220
|
+
if (value.__lookupGetter__(key)) {
|
221
|
+
if (value.__lookupSetter__(key)) {
|
222
|
+
str = ctx.stylize('[Getter/Setter]', 'special');
|
223
|
+
} else {
|
224
|
+
str = ctx.stylize('[Getter]', 'special');
|
225
|
+
}
|
226
|
+
} else {
|
227
|
+
if (value.__lookupSetter__(key)) {
|
228
|
+
str = ctx.stylize('[Setter]', 'special');
|
229
|
+
}
|
230
|
+
}
|
231
|
+
}
|
232
|
+
if (visibleKeys.indexOf(key) < 0) {
|
233
|
+
name = '[' + key + ']';
|
234
|
+
}
|
235
|
+
if (!str) {
|
236
|
+
if (ctx.seen.indexOf(value[key]) < 0) {
|
237
|
+
if (recurseTimes === null) {
|
238
|
+
str = formatValue(ctx, value[key], null);
|
239
|
+
} else {
|
240
|
+
str = formatValue(ctx, value[key], recurseTimes - 1);
|
241
|
+
}
|
242
|
+
if (str.indexOf('\n') > -1) {
|
243
|
+
if (array) {
|
244
|
+
str = str.split('\n').map(function(line) {
|
245
|
+
return ' ' + line;
|
246
|
+
}).join('\n').substr(2);
|
247
|
+
} else {
|
248
|
+
str = '\n' + str.split('\n').map(function(line) {
|
249
|
+
return ' ' + line;
|
250
|
+
}).join('\n');
|
251
|
+
}
|
252
|
+
}
|
253
|
+
} else {
|
254
|
+
str = ctx.stylize('[Circular]', 'special');
|
255
|
+
}
|
256
|
+
}
|
257
|
+
if (typeof name === 'undefined') {
|
258
|
+
if (array && key.match(/^\d+$/)) {
|
259
|
+
return str;
|
260
|
+
}
|
261
|
+
name = JSON.stringify('' + key);
|
262
|
+
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
263
|
+
name = name.substr(1, name.length - 2);
|
264
|
+
name = ctx.stylize(name, 'name');
|
265
|
+
} else {
|
266
|
+
name = name.replace(/'/g, "\\'")
|
267
|
+
.replace(/\\"/g, '"')
|
268
|
+
.replace(/(^"|"$)/g, "'");
|
269
|
+
name = ctx.stylize(name, 'string');
|
270
|
+
}
|
271
|
+
}
|
272
|
+
|
273
|
+
return name + ': ' + str;
|
274
|
+
}
|
275
|
+
|
276
|
+
|
277
|
+
function reduceToSingleString(output, base, braces) {
|
278
|
+
var numLinesEst = 0;
|
279
|
+
var length = output.reduce(function(prev, cur) {
|
280
|
+
numLinesEst++;
|
281
|
+
if (cur.indexOf('\n') >= 0) numLinesEst++;
|
282
|
+
return prev + cur.length + 1;
|
283
|
+
}, 0);
|
284
|
+
|
285
|
+
if (length > 60) {
|
286
|
+
return braces[0] +
|
287
|
+
(base === '' ? '' : base + '\n ') +
|
288
|
+
' ' +
|
289
|
+
output.join(',\n ') +
|
290
|
+
' ' +
|
291
|
+
braces[1];
|
292
|
+
}
|
293
|
+
|
294
|
+
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
295
|
+
}
|
296
|
+
|
297
|
+
function isArray(ar) {
|
298
|
+
return Array.isArray(ar) ||
|
299
|
+
(typeof ar === 'object' && objectToString(ar) === '[object Array]');
|
300
|
+
}
|
301
|
+
|
302
|
+
function isRegExp(re) {
|
303
|
+
return typeof re === 'object' && objectToString(re) === '[object RegExp]';
|
304
|
+
}
|
305
|
+
|
306
|
+
function isDate(d) {
|
307
|
+
return typeof d === 'object' && objectToString(d) === '[object Date]';
|
308
|
+
}
|
309
|
+
|
310
|
+
function isError(e) {
|
311
|
+
return typeof e === 'object' && objectToString(e) === '[object Error]';
|
312
|
+
}
|
313
|
+
|
314
|
+
function objectToString(o) {
|
315
|
+
return Object.prototype.toString.call(o);
|
316
|
+
}
|
data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/objDisplay.js
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
/*!
|
2
|
+
* Chai - flag utility
|
3
|
+
* Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
|
4
|
+
* MIT Licensed
|
5
|
+
*/
|
6
|
+
|
7
|
+
/*!
|
8
|
+
* Module dependancies
|
9
|
+
*/
|
10
|
+
|
11
|
+
var inspect = require('./inspect');
|
12
|
+
|
13
|
+
/**
|
14
|
+
* ### .objDisplay (object)
|
15
|
+
*
|
16
|
+
* Determines if an object or an array matches
|
17
|
+
* criteria to be inspected in-line for error
|
18
|
+
* messages or should be truncated.
|
19
|
+
*
|
20
|
+
* @param {Mixed} javascript object to inspect
|
21
|
+
* @name objDisplay
|
22
|
+
* @api public
|
23
|
+
*/
|
24
|
+
|
25
|
+
module.exports = function (obj) {
|
26
|
+
var str = inspect(obj)
|
27
|
+
, type = Object.prototype.toString.call(obj);
|
28
|
+
|
29
|
+
if (str.length >= 40) {
|
30
|
+
if (type === '[object Function]') {
|
31
|
+
return !obj.name || obj.name === ''
|
32
|
+
? '[Function]'
|
33
|
+
: '[Function: ' + obj.name + ']';
|
34
|
+
} else if (type === '[object Array]') {
|
35
|
+
return '[ Array(' + obj.length + ') ]';
|
36
|
+
} else if (type === '[object Object]') {
|
37
|
+
var keys = Object.keys(obj)
|
38
|
+
, kstr = keys.length > 2
|
39
|
+
? keys.splice(0, 2).join(', ') + ', ...'
|
40
|
+
: keys.join(', ');
|
41
|
+
return '{ Object (' + kstr + ') }';
|
42
|
+
} else {
|
43
|
+
return str;
|
44
|
+
}
|
45
|
+
} else {
|
46
|
+
return str;
|
47
|
+
}
|
48
|
+
};
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/*!
|
2
|
+
* Chai - overwriteMethod utility
|
3
|
+
* Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
|
4
|
+
* MIT Licensed
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* ### overwriteMethod (ctx, name, fn)
|
9
|
+
*
|
10
|
+
* Overwites an already existing method and provides
|
11
|
+
* access to previous function. Must return function
|
12
|
+
* to be used for name.
|
13
|
+
*
|
14
|
+
* utils.overwriteMethod(chai.Assertion.prototype, 'equal', function (_super) {
|
15
|
+
* return function (str) {
|
16
|
+
* var obj = utils.flag(this, 'object');
|
17
|
+
* if (obj instanceof Foo) {
|
18
|
+
* new chai.Assertion(obj.value).to.equal(str);
|
19
|
+
* } else {
|
20
|
+
* _super.apply(this, arguments);
|
21
|
+
* }
|
22
|
+
* }
|
23
|
+
* });
|
24
|
+
*
|
25
|
+
* Can also be accessed directly from `chai.Assertion`.
|
26
|
+
*
|
27
|
+
* chai.Assertion.overwriteMethod('foo', fn);
|
28
|
+
*
|
29
|
+
* Then can be used as any other assertion.
|
30
|
+
*
|
31
|
+
* expect(myFoo).to.equal('bar');
|
32
|
+
*
|
33
|
+
* @param {Object} ctx object whose method is to be overwritten
|
34
|
+
* @param {String} name of method to overwrite
|
35
|
+
* @param {Function} method function that returns a function to be used for name
|
36
|
+
* @name overwriteMethod
|
37
|
+
* @api public
|
38
|
+
*/
|
39
|
+
|
40
|
+
module.exports = function (ctx, name, method) {
|
41
|
+
var _method = ctx[name]
|
42
|
+
, _super = function () { return this; };
|
43
|
+
|
44
|
+
if (_method && 'function' === typeof _method)
|
45
|
+
_super = _method;
|
46
|
+
|
47
|
+
ctx[name] = function () {
|
48
|
+
var result = method(_super).apply(this, arguments);
|
49
|
+
return result === undefined ? this : result;
|
50
|
+
}
|
51
|
+
};
|
@@ -0,0 +1,54 @@
|
|
1
|
+
/*!
|
2
|
+
* Chai - overwriteProperty utility
|
3
|
+
* Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
|
4
|
+
* MIT Licensed
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* ### overwriteProperty (ctx, name, fn)
|
9
|
+
*
|
10
|
+
* Overwites an already existing property getter and provides
|
11
|
+
* access to previous value. Must return function to use as getter.
|
12
|
+
*
|
13
|
+
* utils.overwriteProperty(chai.Assertion.prototype, 'ok', function (_super) {
|
14
|
+
* return function () {
|
15
|
+
* var obj = utils.flag(this, 'object');
|
16
|
+
* if (obj instanceof Foo) {
|
17
|
+
* new chai.Assertion(obj.name).to.equal('bar');
|
18
|
+
* } else {
|
19
|
+
* _super.call(this);
|
20
|
+
* }
|
21
|
+
* }
|
22
|
+
* });
|
23
|
+
*
|
24
|
+
*
|
25
|
+
* Can also be accessed directly from `chai.Assertion`.
|
26
|
+
*
|
27
|
+
* chai.Assertion.overwriteProperty('foo', fn);
|
28
|
+
*
|
29
|
+
* Then can be used as any other assertion.
|
30
|
+
*
|
31
|
+
* expect(myFoo).to.be.ok;
|
32
|
+
*
|
33
|
+
* @param {Object} ctx object whose property is to be overwritten
|
34
|
+
* @param {String} name of property to overwrite
|
35
|
+
* @param {Function} getter function that returns a getter function to be used for name
|
36
|
+
* @name overwriteProperty
|
37
|
+
* @api public
|
38
|
+
*/
|
39
|
+
|
40
|
+
module.exports = function (ctx, name, getter) {
|
41
|
+
var _get = Object.getOwnPropertyDescriptor(ctx, name)
|
42
|
+
, _super = function () {};
|
43
|
+
|
44
|
+
if (_get && 'function' === typeof _get.get)
|
45
|
+
_super = _get.get
|
46
|
+
|
47
|
+
Object.defineProperty(ctx, name,
|
48
|
+
{ get: function () {
|
49
|
+
var result = getter(_super).call(this);
|
50
|
+
return result === undefined ? this : result;
|
51
|
+
}
|
52
|
+
, configurable: true
|
53
|
+
});
|
54
|
+
};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/*!
|
2
|
+
* Chai - test 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
|
+
|
13
|
+
/**
|
14
|
+
* # test(object, expression)
|
15
|
+
*
|
16
|
+
* Test and object for expression.
|
17
|
+
*
|
18
|
+
* @param {Object} object (constructed Assertion)
|
19
|
+
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
20
|
+
*/
|
21
|
+
|
22
|
+
module.exports = function (obj, args) {
|
23
|
+
var negate = flag(obj, 'negate')
|
24
|
+
, expr = args[0];
|
25
|
+
return negate ? !expr : expr;
|
26
|
+
};
|
data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/transferFlags.js
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
/*!
|
2
|
+
* Chai - transferFlags utility
|
3
|
+
* Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
|
4
|
+
* MIT Licensed
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* ### transferFlags(assertion, object, includeAll = true)
|
9
|
+
*
|
10
|
+
* Transfer all the flags for `assertion` to `object`. If
|
11
|
+
* `includeAll` is set to `false`, then the base Chai
|
12
|
+
* assertion flags (namely `object`, `ssfi`, and `message`)
|
13
|
+
* will not be transferred.
|
14
|
+
*
|
15
|
+
*
|
16
|
+
* var newAssertion = new Assertion();
|
17
|
+
* utils.transferFlags(assertion, newAssertion);
|
18
|
+
*
|
19
|
+
* var anotherAsseriton = new Assertion(myObj);
|
20
|
+
* utils.transferFlags(assertion, anotherAssertion, false);
|
21
|
+
*
|
22
|
+
* @param {Assertion} assertion the assertion to transfer the flags from
|
23
|
+
* @param {Object} object the object to transfer the flags too; usually a new assertion
|
24
|
+
* @param {Boolean} includeAll
|
25
|
+
* @name getAllFlags
|
26
|
+
* @api private
|
27
|
+
*/
|
28
|
+
|
29
|
+
module.exports = function (assertion, object, includeAll) {
|
30
|
+
var flags = assertion.__flags || (assertion.__flags = Object.create(null));
|
31
|
+
|
32
|
+
if (!object.__flags) {
|
33
|
+
object.__flags = Object.create(null);
|
34
|
+
}
|
35
|
+
|
36
|
+
includeAll = arguments.length === 3 ? includeAll : true;
|
37
|
+
|
38
|
+
for (var flag in flags) {
|
39
|
+
if (includeAll ||
|
40
|
+
(flag !== 'object' && flag !== 'ssfi' && flag != 'message')) {
|
41
|
+
object.__flags[flag] = flags[flag];
|
42
|
+
}
|
43
|
+
}
|
44
|
+
};
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/*!
|
2
|
+
* Chai - type utility
|
3
|
+
* Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
|
4
|
+
* MIT Licensed
|
5
|
+
*/
|
6
|
+
|
7
|
+
/*!
|
8
|
+
* Detectable javascript natives
|
9
|
+
*/
|
10
|
+
|
11
|
+
var natives = {
|
12
|
+
'[object Arguments]': 'arguments'
|
13
|
+
, '[object Array]': 'array'
|
14
|
+
, '[object Date]': 'date'
|
15
|
+
, '[object Function]': 'function'
|
16
|
+
, '[object Number]': 'number'
|
17
|
+
, '[object RegExp]': 'regexp'
|
18
|
+
, '[object String]': 'string'
|
19
|
+
};
|
20
|
+
|
21
|
+
/**
|
22
|
+
* ### type(object)
|
23
|
+
*
|
24
|
+
* Better implementation of `typeof` detection that can
|
25
|
+
* be used cross-browser. Handles the inconsistencies of
|
26
|
+
* Array, `null`, and `undefined` detection.
|
27
|
+
*
|
28
|
+
* utils.type({}) // 'object'
|
29
|
+
* utils.type(null) // `null'
|
30
|
+
* utils.type(undefined) // `undefined`
|
31
|
+
* utils.type([]) // `array`
|
32
|
+
*
|
33
|
+
* @param {Mixed} object to detect type of
|
34
|
+
* @name type
|
35
|
+
* @api private
|
36
|
+
*/
|
37
|
+
|
38
|
+
module.exports = function (obj) {
|
39
|
+
var str = Object.prototype.toString.call(obj);
|
40
|
+
if (natives[str]) return natives[str];
|
41
|
+
if (obj === null) return 'null';
|
42
|
+
if (obj === undefined) return 'undefined';
|
43
|
+
if (obj === Object(obj)) return 'object';
|
44
|
+
return typeof obj;
|
45
|
+
};
|