solv
v1.1.5
Published
Library for building object-oriented APIs
Downloads
133
Maintainers
Readme
Object-Oriented Modular JavaScript Library
Solv is a collection of AMD JavaScript modules built for object-oriented application development. Solv is very API focused. Solv reduces boilerplate code by handling lots of the plumbing involved in building class APIs (methods, events and properties). Solv is for the browser and for Node.js. It contains tools for:
- Creating class hierarchies
- Class mixins
- Method overloading
- Declaring default arguments and properties
- Type checking arguments and return values
- Custom events
- and more...
Install
The two easiest ways to install solv are npm and bower. Solv can also be installed by downloading or cloning from github. Solv is a modular library and doesn't offer a concatenated file for distribution. Once Solv is installed each of it's modules can be pulled in when and where needed.
- To install into a node project - run
npm install solv
- To install into a browser project - run
bower install solv
- To get a copy of the source - run
git clone https://github.com/bob-gray/solv.git
Supported Browsers
The browsers and platforms represented below are those that are tested as part of Solv's build.
Design Goals
Solv strives to be as simple and robust in its implementation as possible. Code quality is important. Clean, obvious code is valued over clever, obfuscated code accompanied by verbose comments. Comments are only present in Solv when all attempts to refactor for clarity have failed. Developer productivity is valued over premature optimization. Solv's API is designed to be easy and fun to use.
Prototypes
Solv augments native prototypes to provide the best possible API. There are risks when altering native prototypes. Native prototypes are global and collision with other code or future native APIs is possible. On the other hand, member functions enhance the clarity of many operations. This makes augmenting native prototypes very attractive.
Tests
Solv has a fairly extensive test suite that is continuing to grow. To run tests Node.js and npm must be installed and a couple sets of commands need to be run.
Test from Command Line
- Run
npm install -g grunt-cli
to install grunt command line interface - Run
npm install
to install test dependencies - Run
grunt test
to execute test
See Gruntfile for more test and analysis options.
Test in Browser
- Run
npm install -g bower
to install bower - Run
bower install
to install test dependencies - Open
tests/index.html
in the browser of your choice
Meta
Solv is being developed in conjunction with
meta-json and
api-meta, projects advocating the use
of meta data declared as JSON. This meta data can then drive runtime behavior and be
parsed statically for documentation generation. Solv includes a meta
runtime
implementation that is meta-json compliant and many of the methods contained
in Solv accept options objects comforming to api-meta. Building application with Solv and
declaring options with meta
means documenations is tied directly to
implementation. meta-json and api-meta are still works in progress as is Solv.
Stay tuned...