@buley/dash 0.0.30 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -65
- package/dist/src/engine/ai.d.ts +10 -0
- package/dist/src/engine/ai.js +46 -0
- package/dist/src/engine/sqlite.d.ts +31 -0
- package/dist/src/engine/sqlite.js +255 -0
- package/dist/src/engine/vec_extension.d.ts +5 -0
- package/dist/src/engine/vec_extension.js +10 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +3 -0
- package/dist/src/mcp/server.d.ts +8 -0
- package/dist/src/mcp/server.js +87 -0
- package/dist/src/reactivity/signal.d.ts +3 -0
- package/dist/src/reactivity/signal.js +31 -0
- package/dist/src/sync/backup.d.ts +12 -0
- package/dist/src/sync/backup.js +44 -0
- package/dist/src/sync/connection.d.ts +16 -0
- package/dist/src/sync/connection.js +29 -0
- package/dist/src/sync/provider.d.ts +11 -0
- package/dist/src/sync/provider.js +67 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +33 -31
- package/.coveralls.yml +0 -1
- package/.github/workflows/opencommit.yml +0 -33
- package/.github/workflows/testing.yml +0 -20
- package/.gitmodules +0 -0
- package/behaviors/cache.dev.js +0 -282
- package/behaviors/changes.dev.js +0 -337
- package/behaviors/collect.dev.js +0 -40
- package/behaviors/examples/async.dev.js +0 -17
- package/behaviors/firebase.dev.js +0 -283
- package/behaviors/live.dev.js +0 -67
- package/behaviors/map.dev.js +0 -54
- package/behaviors/mapreduce.dev.js +0 -68
- package/behaviors/match.dev.js +0 -66
- package/behaviors/patch.dev.js +0 -69
- package/behaviors/rest.dev.js +0 -340
- package/behaviors/shorthand.dev.js +0 -59
- package/behaviors/stats.dev.js +0 -672
- package/dist/behaviors/index.js +0 -142
- package/dist/database/index.js +0 -76
- package/dist/databases/index.js +0 -121
- package/dist/entry/index.js +0 -166
- package/dist/index.js +0 -93
- package/dist/indexes/index.js +0 -153
- package/dist/store/index.js +0 -97
- package/dist/stores/index.js +0 -90
- package/dist/utilities/index.js +0 -174
- package/documentation/database/closing.md +0 -3
- package/documentation/database/getting.md +0 -1
- package/documentation/database/opening.md +0 -5
- package/documentation/database/removing.md +0 -3
- package/documentation/databases.md +0 -21
- package/documentation/entries.md +0 -13
- package/documentation/entry/adding.md +0 -1
- package/documentation/entry/getting.md +0 -4
- package/documentation/entry/putting.md +0 -0
- package/documentation/entry/removing.md +0 -3
- package/documentation/entry/updating.md +0 -0
- package/documentation/general/security.md +0 -10
- package/documentation/general/transaction/requests.md +0 -3
- package/documentation/general/transactions.md +0 -5
- package/documentation/index/creating.md +0 -1
- package/documentation/index/getting.md +0 -1
- package/documentation/index/iterating.md +0 -1
- package/documentation/index/removing.md +0 -1
- package/documentation/indexes.md +0 -3
- package/documentation/key/cursors.md +0 -5
- package/documentation/key/range/bounds.md +0 -11
- package/documentation/key/range/direction.md +0 -1
- package/documentation/key/ranges.md +0 -3
- package/documentation/keys.md +0 -12
- package/documentation/objectstore/clearing.md +0 -1
- package/documentation/objectstore/creating.md +0 -1
- package/documentation/objectstore/getting.md +0 -1
- package/documentation/objectstore/iteration.md +0 -1
- package/documentation/objectstore/removing.md +0 -1
- package/documentation/overview.md +0 -5
- package/documentation/stores.md +0 -13
- package/jest.config.js +0 -12
- package/src/behaviors/index.ts +0 -140
- package/src/database/index.ts +0 -81
- package/src/databases/index.ts +0 -127
- package/src/entry/index.ts +0 -183
- package/src/index/index.ts +0 -61
- package/src/index.ts +0 -96
- package/src/indexes/index.ts +0 -151
- package/src/store/index.ts +0 -102
- package/src/stores/index.ts +0 -90
- package/src/utilities/index.ts +0 -349
- package/tests/behaviors/behaviors.spec.ts +0 -123
- package/tests/database/database.spec.ts +0 -177
- package/tests/databases/databases.spec.ts +0 -199
- package/tests/entry/entry.spec.ts +0 -252
- package/tests/index/index.spec.ts +0 -94
- package/tests/indexes/indexes.spec.ts +0 -203
- package/tests/store/store.spec.ts +0 -164
- package/tests/stores/stores.spec.ts +0 -148
- package/tests/utilities/clone.spec.ts +0 -48
- package/tests/utilities/cloneError.spec.ts +0 -33
- package/tests/utilities/contains.spec.ts +0 -28
- package/tests/utilities/exists.spec.ts +0 -21
- package/tests/utilities/is.spec.ts +0 -37
- package/tests/utilities/isArray.spec.ts +0 -21
- package/tests/utilities/isBoolean.spec.ts +0 -23
- package/tests/utilities/isEmpty.spec.ts +0 -45
- package/tests/utilities/isFunction.spec.ts +0 -30
- package/tests/utilities/isNumber.spec.ts +0 -29
- package/tests/utilities/isObject.spec.ts +0 -42
- package/tests/utilities/isRegEx.spec.ts +0 -33
- package/tests/utilities/isString.spec.ts +0 -25
- package/tests/utilities/isnt.spec.ts +0 -50
- package/tests/utilities/randomId.spec.ts +0 -39
- package/tests/utilities/safeApply.spec.ts +0 -49
- package/tests/utilities/safeEach.spec.ts +0 -38
- package/tests/utilities/safeIterate.spec.ts +0 -47
- package/tsconfig.json +0 -16
package/behaviors/rest.dev.js
DELETED
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
self.dashRest = self.dashRest || (function (environment) {
|
|
2
|
-
"use strict";
|
|
3
|
-
var that,
|
|
4
|
-
rest = {},
|
|
5
|
-
ajax = function( context ) {
|
|
6
|
-
var request_type = context.method,
|
|
7
|
-
url = context.url,
|
|
8
|
-
input = context.data,
|
|
9
|
-
params = context.params,
|
|
10
|
-
callback = context.callback,
|
|
11
|
-
fallbacks = ['MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'],
|
|
12
|
-
request,
|
|
13
|
-
serialize = function (data) {
|
|
14
|
-
var queryString = '',
|
|
15
|
-
attr;
|
|
16
|
-
if ('string' !== typeof data) {
|
|
17
|
-
for (attr in data) {
|
|
18
|
-
if (data.hasOwnProperty(attr)) {
|
|
19
|
-
queryString += "&" + encodeURIComponent(attr) + '=' + encodeURIComponent(data[attr]);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
queryString = queryString.replace(/^&/, '');
|
|
23
|
-
} else {
|
|
24
|
-
queryString = data;
|
|
25
|
-
}
|
|
26
|
-
return queryString;
|
|
27
|
-
},
|
|
28
|
-
qs = serialize(params),
|
|
29
|
-
formencoded = serialize(input),
|
|
30
|
-
i = 0,
|
|
31
|
-
error = null;
|
|
32
|
-
if (environment.XMLHttpRequest) {
|
|
33
|
-
request = new XMLHttpRequest();
|
|
34
|
-
} else {
|
|
35
|
-
for (i = 0; i < fallbacks.length; i++) {
|
|
36
|
-
try {2
|
|
37
|
-
request = new ActiveXObject(fallbacks[i]);
|
|
38
|
-
break;
|
|
39
|
-
} catch (e) {}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
request.addEventListener('readystatechange', function (e) {
|
|
43
|
-
if ('function' === typeof callback && 4 === request.readyState && null !== request.status.toString().match(/^2/)) {
|
|
44
|
-
var json;
|
|
45
|
-
try {
|
|
46
|
-
json = JSON.parse(request.responseText);
|
|
47
|
-
} catch(e) {
|
|
48
|
-
//not json (or bad json)
|
|
49
|
-
}
|
|
50
|
-
error = null;
|
|
51
|
-
callback(json || request.responseText, error, e, request);
|
|
52
|
-
} else if ('function' === typeof callback && 4 === request.readyState && null !== request.status.toString().match(/^[34]/)) {
|
|
53
|
-
var json;
|
|
54
|
-
//TODO: Handle this
|
|
55
|
-
try {
|
|
56
|
-
json = JSON.parse(request.responseText);
|
|
57
|
-
} catch(e) {
|
|
58
|
-
//not json (or bad json)
|
|
59
|
-
}
|
|
60
|
-
error = request.status.toString();
|
|
61
|
-
callback(json || request.responseText, error, e, request);
|
|
62
|
-
}
|
|
63
|
-
}, true);
|
|
64
|
-
|
|
65
|
-
if (request_type.toUpperCase() === 'GET') {
|
|
66
|
-
request.open(request_type, url + (qs ? '?' + qs : ''), true);
|
|
67
|
-
request.send();
|
|
68
|
-
} else {
|
|
69
|
-
request.open(request_type, url + (qs ? '?' + qs : ''), true);
|
|
70
|
-
if (false === context.json) {
|
|
71
|
-
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
72
|
-
request.send(formencoded);
|
|
73
|
-
} else {
|
|
74
|
-
request.setRequestHeader('Content-Type', 'application/javascript');
|
|
75
|
-
request.send(JSON.stringify(input));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
get = function( context ) {
|
|
81
|
-
context.method = 'GET';
|
|
82
|
-
ajax(context);
|
|
83
|
-
},
|
|
84
|
-
post = function( context ) {
|
|
85
|
-
context.method = 'POST';
|
|
86
|
-
ajax(context);
|
|
87
|
-
},
|
|
88
|
-
put = function( context ) {
|
|
89
|
-
context.method = 'PUT';
|
|
90
|
-
ajax(context);
|
|
91
|
-
},
|
|
92
|
-
remove = function( context ) {
|
|
93
|
-
context.method = 'DELETE';
|
|
94
|
-
ajax(context);
|
|
95
|
-
},
|
|
96
|
-
whichMethod = function(signature) {
|
|
97
|
-
if ( that.contains( [ 'get.entry', 'get.entries', 'get.index', 'get.database', 'get.store' ], signature)) {
|
|
98
|
-
return 'GET';
|
|
99
|
-
} else if ( that.contains([ 'remove.entry', 'remove.entries', 'remove.index', 'remove.database', 'remove.store' ], signature)) {
|
|
100
|
-
return 'DELETE';
|
|
101
|
-
} else if ( that.contains([ 'add.entry' ], signature)) {
|
|
102
|
-
return 'POST';
|
|
103
|
-
} else if ( that.contains([ 'update.entry', 'update.entries' ], signature)) {
|
|
104
|
-
return 'PUT';
|
|
105
|
-
} else {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
scripts = ( !! environment.document) ? environment.document.getElementsByTagName("script") : [],
|
|
110
|
-
libraryScript = scripts[scripts.length - 1] || null,
|
|
111
|
-
libraryPath =( null !== libraryScript && null === libraryScript.src.match(/chrome-extension/) ) ? libraryScript.src : null,
|
|
112
|
-
workerEnvironment = null !== environment.constructor.toString().match(/WorkerGlobalScope/),
|
|
113
|
-
worker,
|
|
114
|
-
workQueue = {},
|
|
115
|
-
workRegister = function (worker, message, context, success, error, notify) {
|
|
116
|
-
var id = that.random(),
|
|
117
|
-
callback = function (e) {
|
|
118
|
-
var data = e.data,
|
|
119
|
-
queued = workQueue[data.uid];
|
|
120
|
-
if (undefined !== queued) {
|
|
121
|
-
switch (e.data.type) {
|
|
122
|
-
case 'success':
|
|
123
|
-
delete workQueue[data.uid];
|
|
124
|
-
worker.removeEventListener('message', callback);
|
|
125
|
-
that.apply(success, [data]);
|
|
126
|
-
break;
|
|
127
|
-
case 'error':
|
|
128
|
-
delete workQueue[data.uid];
|
|
129
|
-
worker.removeEventListener('message', callback);
|
|
130
|
-
that.apply(error, [data]);
|
|
131
|
-
break;
|
|
132
|
-
case 'abort':
|
|
133
|
-
that.apply(notify, [data]);
|
|
134
|
-
break;
|
|
135
|
-
default:
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
clean = function(obj) {
|
|
141
|
-
if (that.isFunction(obj)) {
|
|
142
|
-
return undefined;
|
|
143
|
-
} else if (that.isObject(obj)) {
|
|
144
|
-
that.iterate(obj, function(key, val) {
|
|
145
|
-
obj[ key ] = clean(val);
|
|
146
|
-
});
|
|
147
|
-
} else if (that.isArray(obj)) {
|
|
148
|
-
that.each(obj, function(v, i) {
|
|
149
|
-
obj[i] = clean(v);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
return obj;
|
|
153
|
-
};
|
|
154
|
-
workQueue[id] = {
|
|
155
|
-
success: success,
|
|
156
|
-
error: error,
|
|
157
|
-
notify: notify
|
|
158
|
-
};
|
|
159
|
-
worker.addEventListener('message', callback);
|
|
160
|
-
worker.postMessage({
|
|
161
|
-
method: message,
|
|
162
|
-
context: clean(context),
|
|
163
|
-
uid: id
|
|
164
|
-
});
|
|
165
|
-
return id;
|
|
166
|
-
},
|
|
167
|
-
workDispatch = function (message, context) {
|
|
168
|
-
var defd = that.deferred(),
|
|
169
|
-
callbacks = {
|
|
170
|
-
on_success: context.on_success,
|
|
171
|
-
on_error: context.on_error,
|
|
172
|
-
on_abort: context.on_abort,
|
|
173
|
-
on_complete: context.on_complete,
|
|
174
|
-
on_upgrade_needed: context.on_upgrade_needed,
|
|
175
|
-
on_blocked: context.on_blocked,
|
|
176
|
-
on_close: context.on_close
|
|
177
|
-
},
|
|
178
|
-
getData = function (data) {
|
|
179
|
-
if( that.isObject(data) ) {
|
|
180
|
-
that.iterate(callbacks, function (key, val) {
|
|
181
|
-
if(!!val) {
|
|
182
|
-
data[key] = val;
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
return data;
|
|
187
|
-
};
|
|
188
|
-
that.iterate(callbacks, function (key, val) {
|
|
189
|
-
delete context[key];
|
|
190
|
-
});
|
|
191
|
-
workRegister(worker, message, context, function (data) {
|
|
192
|
-
var add_ctx = that.clone(context);
|
|
193
|
-
add_ctx.data = data.context.entry;
|
|
194
|
-
add_ctx.resting = true;
|
|
195
|
-
that.api.add.entry(add_ctx)(function(added_ctx) {
|
|
196
|
-
delete added_ctx.resting;
|
|
197
|
-
defd.resolve(getData(added_ctx));
|
|
198
|
-
}, function(added_ctx) {
|
|
199
|
-
delete added_ctx.resting;
|
|
200
|
-
defd.reject(getData(added_ctx));
|
|
201
|
-
}, function(added_ctx) {
|
|
202
|
-
delete added_ctx.resting;
|
|
203
|
-
defd.notify(getData(added_ctx));
|
|
204
|
-
})
|
|
205
|
-
}, function (data) {
|
|
206
|
-
defd.reject(getData(data));
|
|
207
|
-
}, function (data) {
|
|
208
|
-
defd.notify(getData(data));
|
|
209
|
-
});
|
|
210
|
-
return defd.promise;
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
if (true === workerEnvironment) {
|
|
214
|
-
environment.addEventListener('message', function (e) {
|
|
215
|
-
var input = e.data,
|
|
216
|
-
method = input.method,
|
|
217
|
-
value = input.value,
|
|
218
|
-
key = input.key,
|
|
219
|
-
context = input.context,
|
|
220
|
-
params = context.params,
|
|
221
|
-
expires = input.expires,
|
|
222
|
-
end = function (ctx) {
|
|
223
|
-
ctx.type = ctx.type || 'success';
|
|
224
|
-
environment.postMessage(ctx);
|
|
225
|
-
},
|
|
226
|
-
callback = function(sig) {
|
|
227
|
-
return function(data, error) {
|
|
228
|
-
delete input.context.callback;
|
|
229
|
-
if (!!error) {
|
|
230
|
-
input.context.error = error;
|
|
231
|
-
input.context.message = data;
|
|
232
|
-
input.type = 'error';
|
|
233
|
-
} else {
|
|
234
|
-
input.context.entry = data;
|
|
235
|
-
}
|
|
236
|
-
end(input);
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
if (method === 'GET' || method === 'PUT' || method === 'POST' || method === 'DELETE') {
|
|
240
|
-
context.callback = callback(method);
|
|
241
|
-
if ( method === 'GET' ) {
|
|
242
|
-
get(context);
|
|
243
|
-
} else if ( method === 'POST' ) {
|
|
244
|
-
post(context);
|
|
245
|
-
} else if ( method === 'PUT' ) {
|
|
246
|
-
put(context);
|
|
247
|
-
} else if ( method === 'DELETE' ) {
|
|
248
|
-
remove(context);
|
|
249
|
-
}
|
|
250
|
-
} else {
|
|
251
|
-
input.type = 'error';
|
|
252
|
-
end({
|
|
253
|
-
type: 'abort',
|
|
254
|
-
context: input,
|
|
255
|
-
error: 'No such method'
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
}, false);
|
|
259
|
-
} else {
|
|
260
|
-
return function(libraryPath) {
|
|
261
|
-
worker = !!libraryPath ? new Worker(libraryPath) : null
|
|
262
|
-
return [ function (state) {
|
|
263
|
-
that = this;
|
|
264
|
-
if(this.isnt(state.context.rest, true) || this.exists(state.context.resting)) {
|
|
265
|
-
return state;
|
|
266
|
-
}
|
|
267
|
-
state.context.restid = this.random();
|
|
268
|
-
rest[ state.context.restid ] = {
|
|
269
|
-
url: state.context.url,
|
|
270
|
-
params: state.context.params ? state.context.params : null
|
|
271
|
-
}
|
|
272
|
-
delete state.context.url;
|
|
273
|
-
delete state.context.params;
|
|
274
|
-
return state;
|
|
275
|
-
}, function (state) {
|
|
276
|
-
if(this.isnt(state.context.rest, true) || this.exists(state.context.resting)) {
|
|
277
|
-
return state;
|
|
278
|
-
}
|
|
279
|
-
var promise = state.promise,
|
|
280
|
-
outward = this.deferred(),
|
|
281
|
-
inward,
|
|
282
|
-
update = false,
|
|
283
|
-
args;
|
|
284
|
-
if (this.contains(['add.entry', 'update.entry', 'update.entries', 'remove.entry', 'remove.entries'], state.method)) {
|
|
285
|
-
if (this.contains(['notify', 'resolve'], state.type)) {
|
|
286
|
-
update = true;
|
|
287
|
-
}
|
|
288
|
-
} else {
|
|
289
|
-
if ((this.is('error', state.type) || (this.isEmpty(state.context.entry) && this.contains(['get.entry', 'get.entries'], state.method))) && (this.is(state.context.rest, true) || this.is(state.context.fallback, true))) {
|
|
290
|
-
update = true;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
args = rest[ state.context.restid ];
|
|
294
|
-
if (update) {
|
|
295
|
-
state.promise = outward.promise;
|
|
296
|
-
state.context.url = args.url;0
|
|
297
|
-
if (that.isFunction(state.context.url)) {
|
|
298
|
-
state.context.url = that.apply(state.context.url, [that.clone(state)]);
|
|
299
|
-
}
|
|
300
|
-
if (that.isFunction(state.context.params)) {
|
|
301
|
-
state.context.params = that.apply(state.context.params, [that.clone(state)]);
|
|
302
|
-
}
|
|
303
|
-
state.context.params = args.params;
|
|
304
|
-
inward = workDispatch( whichMethod(state.method), state.context);
|
|
305
|
-
inward(function(ctx2){
|
|
306
|
-
ctx2.url = args.url;
|
|
307
|
-
ctx2.params = args.params;
|
|
308
|
-
state.context = ctx2;
|
|
309
|
-
state.type = 'resolve';
|
|
310
|
-
delete rest[ ctx2.restid ];
|
|
311
|
-
delete ctx2.restid;
|
|
312
|
-
outward.resolve(state.context);
|
|
313
|
-
}, function(ctx2) {
|
|
314
|
-
ctx2.url = args.url;
|
|
315
|
-
ctx2.params = args.params;
|
|
316
|
-
delete rest[ ctx2.restid ];
|
|
317
|
-
delete ctx2.restid;
|
|
318
|
-
state.context = ctx2;
|
|
319
|
-
state.type = 'error';
|
|
320
|
-
outward.reject(state.context);
|
|
321
|
-
}, function(ctx2) {
|
|
322
|
-
ctx2.url = args.url;
|
|
323
|
-
ctx2.params = args.params;
|
|
324
|
-
delete rest[ ctx2.restid ];
|
|
325
|
-
delete ctx2.restid;
|
|
326
|
-
state.type = 'notify';
|
|
327
|
-
state.context = ctx2;
|
|
328
|
-
outward.notify(state.context);
|
|
329
|
-
});
|
|
330
|
-
} else {
|
|
331
|
-
state.context.url = args.url;
|
|
332
|
-
state.context.params = args.params;
|
|
333
|
-
delete rest[ state.context.restid ];
|
|
334
|
-
delete state.context.restid;
|
|
335
|
-
}
|
|
336
|
-
return state;
|
|
337
|
-
} ];
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
}(self));
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
var dashShorthand = (function (environment) {
|
|
2
|
-
"use strict";
|
|
3
|
-
var that,
|
|
4
|
-
reduce = function(map, expr, context, reverse) {
|
|
5
|
-
if (that.isFunction(expr)) {
|
|
6
|
-
expr = that.apply(expr, [context], that);
|
|
7
|
-
}
|
|
8
|
-
if (that.isObject(expr)) {
|
|
9
|
-
that.iterate(expr, function(key, value) {
|
|
10
|
-
if (!that.isEmpty(map[key])) {
|
|
11
|
-
delete expr[key];
|
|
12
|
-
key = map[key];
|
|
13
|
-
}
|
|
14
|
-
expr[key] = reduce(map, value, context, reverse);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return expr;
|
|
18
|
-
}, reverse = function(expr) {
|
|
19
|
-
if (that.isObject(expr)) {
|
|
20
|
-
that.iterate(expr, function(key, value) {
|
|
21
|
-
if (that.isObject(value)) {
|
|
22
|
-
expr[key] = reverse(value);
|
|
23
|
-
} else {
|
|
24
|
-
expr[value] = key;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
return expr;
|
|
29
|
-
};
|
|
30
|
-
return [ function (state) {
|
|
31
|
-
that = this;
|
|
32
|
-
if(this.isEmpty(state.context.shorthand)) {
|
|
33
|
-
return state;
|
|
34
|
-
}
|
|
35
|
-
var data = state.context.data,
|
|
36
|
-
shorthand = state.context.shorthand;
|
|
37
|
-
if (!this.isEmpty(data)) {
|
|
38
|
-
if (!!shorthand.after || !!shorthand.before) {
|
|
39
|
-
shorthand = shorthand.before;
|
|
40
|
-
}
|
|
41
|
-
state.context.data = reduce(reverse(shorthand), data, state.context, false);
|
|
42
|
-
}
|
|
43
|
-
return state;
|
|
44
|
-
}, function (state) {
|
|
45
|
-
that = this;
|
|
46
|
-
if(this.isEmpty(state.context.shorthand)) {
|
|
47
|
-
return state;
|
|
48
|
-
}
|
|
49
|
-
var data = state.context.entry,
|
|
50
|
-
shorthand = state.context.shorthand;
|
|
51
|
-
if (!this.isEmpty(data)) {
|
|
52
|
-
if (!!shorthand.after || !!shorthand.before) {
|
|
53
|
-
shorthand = shorthand.after;
|
|
54
|
-
}
|
|
55
|
-
state.context.entry = reduce(shorthand, data, state.context);
|
|
56
|
-
}
|
|
57
|
-
return state;
|
|
58
|
-
} ];
|
|
59
|
-
}(self));
|