klortho / config-one Goto Github PK
View Code? Open in Web Editor NEWOne config library to rule them all
One config library to rule them all
This is one possible way to address the issue of class instances not being represented faithfully by views, and losing their prototype when getting copied.
With this idea, you could extend config-one on the fly, before you use it. E.g.
// Extend config-one on the fly, to tell it to treat tinycolor objects
// as atomic.
const C1 = TreeChart.config1.new({
atomTests: [
obj => obj instanceof tinycolor,
],
});
But I ran into a problem: many of the methods in seed.js are not being invoked as methods. So nodeType() is not getting a reference to the current config1 object, so it has no access to the options for that object.
I started trying to go through and systematically make sure everything's getting called as a method when it should, in this commit, but it is a bit messy, and I'm afraid of breaking something.
It should be done eventually, though.
For now, another way suggests itself: attach an ES6 symbol to the tinycolor constuctor.
An array is shown in an example, so it would be help to clarify how array merging works.
Consider these two arrays in a parent and child configuration. How should they be merged?
// parent
[ 'a','b','a','b','a']
// child
[null,'a','b']
Should the child's array replace the parent's array wholesale?
Should we assume that the the positions in the second array correspond to those in the parent? How then would we express removing the first elements of the array in the child? How can we tell which 'a','b' in the child corresponds to 'a', 'b' values in the parent?
The node-config
solution was not provide a simple predictable results: Values in arrays in arrays are not merged (even if they are deeply nested objects). An array in the child always replaces an array in the parent.
This is occasionally inconvenient, but wins for being simple and dependable.
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.