robtweed / ewd-document-store Goto Github PK
View Code? Open in Web Editor NEWPersistent JavaScript Objects and Document Database using Global Storage
Persistent JavaScript Objects and Document Database using Global Storage
Hi @robtweed
Please consider the following example:
var actual = convert('0.foo');
it returns NaN
but I expect '0.foo' to be returned
Hi @robtweed
Please take a look:
ewd-document-store/lib/proto/value.js
Line 43 in 36d15aa
I think this._set.call(this, value);
can be replaced to this._set(value)
here because in getter we use this context normally
As we already discussed here: QEWD-Courier/Ripple-Qewd#40
How can setDocument()
support UTF 8?
Thanks
Hi,
The following test falls when 'gtm' provider is used for running integration tests
https://github.com/robtweed/ewd-document-store/blob/master/spec/integration/ewd-document-store.spec.js#L295
It seems that works fine for InterSystem Caché (have no chance to run it without cache.node) but fails when Gtm used.
The problem is here:
(1) https://github.com/robtweed/ewd-document-store/blob/master/lib/proto/forEach.js#L83
(2) https://github.com/robtweed/ewd-document-store/blob/master/lib/proto/forEach.js#L87
For Gtm (2) returns the following result
node before = '{"global":"temp","subscripts":["foo","Davisþ"]}'
end / result = undefined
However, if I comment out (1), (2) returns the following:
node before = '{"global":"temp","subscripts":["foo","Davis"]}'
end/result = 'Douglas'
and seems works.
Also, please note that FIELD_MARK also used here
https://github.com/robtweed/ewd-document-store/blob/master/lib/proto/forEach.js#L75
@robtweed Do you have any ideas?
Hey @robtweed
forEachLeafNode and forEachChild return first parameter in callback differently
forEachLeafNode: node.data
forEachChild: node.result
I think you know about it, just want to make sure
@robtweed Please take a look:
ewd-document-store/lib/proto/getDocument.js
Lines 96 to 104 in a771f87
What if node has data and has sub nodes (defined = 11)? In this case data set on line 97 was replaced on line 103. Is it correct?
This doesn't work because
var a = null;
typeof a === 'object' // true
above, we have this validation: https://github.com/robtweed/ewd-document-store/blob/master/lib/proto/setDocument.js#L49
Having the same variable name that setDocument is
ewd-document-store/lib/proto/forEach.js
Line 123 in 55179cb
index
after gnode
thisArg
to forEachChild
method like Array.forEach
doesewd-document-store/lib/proto/value.js
Line 45 in 55179cb
ewd-document-store/lib/proto/forEach.js
Line 72 in 55179cb
ewd-document-store/lib/proto/forEach.js
Line 101 in 55179cb
https://github.com/robtweed/ewd-document-store/blob/master/lib/proto/forEach.js#L123-L124
quit if callback returns true
https://github.com/robtweed/ewd-document-store/blob/master/lib/proto/forEachLeafNode.js#L61-L62
quit if callback returns false
I think it should be the same
Haven't found the reference in docs to ok prop in response object. Could you please refer me to it?
ewd-document-store/lib/proto/getDocument.js
Line 184 in 55179cb
Maybe defined
should be there instead of ok
?
Hi @robtweed
During fixing memory db that I use for tests I found an interesting scenario that breaks forEachChild
. The execution never stops for me.
It relates with the following functionality:
https://github.com/robtweed/ewd-document-store/blob/master/lib/proto/forEach.js#L78
The test case:
var documentStore = new DocumentStore(db); // db - GTM
var documentNode = new documentStore.DocumentNode('temp');
documentNode.delete();
var foo = {
a: 'this is a',
b: 'this is b',
Barton: 'J',
Briggs: 'A',
Davies: 'D',
Davis: 'T',
Douglas: 'N',
c: ['a', 's', 'd'],
d: {
a: 'a',
b: 'b'
}
};
documentNode.$('foo').setDocument(foo);
documentNode.$('foo').forEachChild({
range: {
to: '123'
}
}, function (nodeName, node) {
// do somethng
});
Even if the test case is not correct, I think we need to handle this behaviour. Another question, could you please provide me with example of correct test case for https://github.com/robtweed/ewd-document-store/blob/master/lib/proto/forEach.js#L78 I guess it should work with arrays only
@robtweed have a question,
What should be the result value here? getDocument returns
{ bar: 'barValue', baz: 'bazValue', foo: 'fooValue' }
I have a feeling that this line
https://github.com/robtweed/ewd-document-store/blob/master/lib/proto/count.js#L39
should be replace to
if (node.result !== '') count++;
db.order is used in 2 places here when useArray equals true
I think cache pattern may be used here...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.