semmypurewal / jermaine Goto Github PK
View Code? Open in Web Editor NEWyet another javascript modeling tool
License: Other
yet another javascript modeling tool
License: Other
All attributes should be initialized to null in a model. This helps remove some confusion that can be caused by them being set to undefined.
Figure out a way to have Jermaine objects renderable via a view system like Handlebar or Mustache. The API should be really simple, preferably something like this:
Person.looksLike("template.js");
where template.js is a template file in a separate (views?) directory. The simpler the API, the better.
This isn't happening yet because of our approach to implementing inheritance and making the instanceof operator work. We set the prototype to an instance of the super-model but then override each individual attribute with an actual cloned attribute. This is necessary to maintain encapsulation of the attribute.
We'll have to re-think our approach slightly to make this work.
Something like:
model.prototype[methodName] = methodBody
in model.respondsTo
This test seems to fail:
it("another bug?", function () {
var Person,
p, p1, p2, p3, p4;
Person = new Model(function () {
this.hasA("name").which.isA("string");
this.hasMany("friends").eachOfWhich.validateWith(function (friend) {
return friend instanceof Person;
});
});
expect(function () {
p = new Person("Semmy");
}).not.toThrow();
});
Use JSDoc or something similar to generate HTML documentation for Jermaine's public API, particularly the Model function and Model objects.
Allow an option for the user to use JavaScript style constructors for model instances, e.g.
var p = new Person({"name":"Semmy", "id":1001});
Right now an instance of a model gets all of the methods associated with an EventEmitter. Those should be hidden within the object, with the exception of the 'on' method.
If we decide we need more explicit access to the emitter for instances, we can create a 'getter' called 'emitter'.
This test fails:
it("should throw an error if the defaultValue is a function that returns null and null doesn't pass the validator", function () {
var Person = new Model(function () {
this.hasA("name").which.validatesWith(function (name) {
return typeof(name) === "string";
});
});
expect(function () {
p = new Person();
}).toThrow();
});
This test is failing.
var p1, p2;
p1 = new Person();
p2 = new Person();
expect(spy1.callCount).toBe(0);
expect(spy2.callCount).toBe(0);
p1.on("change", spy1);
p2.on("change", spy2);
p1.name("semmy");
expect(spy1.callCount).toBe(1);
expect(spy2.callCount).toBe(0);
Need to come up with a concrete example for this.
This test is failing
it("should not throw an error when called on a null value", function () {
var p = new Person();
p.nullValue(null);
expect(function () {
p.toJSON();
}).not.toThrow();
});
add attr_list removeAt() met hod
add built-in validators for 'matches' (regexp) and 'isInRange'
Versions of IE prior to 9 do not have an implementation of Array.indexOf().
Issue arises in Validator.js -> isA
The documentation needs to be updated. Also, inline documentation needs to be added to all core objects.
This jasmine test is failing
describe("pop method", function () {
it("should return the object which was popped", function () {
var lastObj = "mark",
poppedObj;
obj.friends().add("john");
obj.friends().add("semmy");
obj.friends().add(lastObj);
poppedObj = obj.friends().pop();
expect(poppedObj).toEqual(lastObj);
});
it("should decrease the size of the attr_list", function () {
var size;
obj.friends().add("john");
obj.friends().add("semmy");
obj.friends().add("mark");
size = obj.friends().size();
obj.friends().pop();
expect(obj.friends().size()).toEqual(size-1);
});
});
Something like this:
this.hasA("thing").which.isA("string").that.canBe(null);
We need a new solution for handling errors. This is due to error messages currently being specified in two places: the src file that throws the errors and spec files which checks for the error message. This is an inefficient and bug-prone approach.
A better solution might be to create a type-hierarchy of Errors/Exceptions, and check for the types in the spec file, rather than specific messages.
Unit tests need to be reviewed and cleaned up.
check for indentation and spaces between for and if, also check that <=> this in constructor and create function to make sure they are being used.
var p1, p2;
p1 = new Person();
p2 = new Person();
expect(spy1.callCount).toBe(0)
expect(spy2.callCount).toBe(0)
p1.on("change", spy1);
p2.on("change", spy2);
p1.friend(p2);
expect(spy1.callCount).toBe(1);
expect(spy2.callCount).toBe(0);
//causes infinite loop
p2.friend(p1);
remove ordering from attr_list, add whichIsOrdered() or some such
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.