Note:
Maddy is no longer under active development. For an alternative utility library, please check out Lo-Dash.
Maddy is a functional object operations library. It provides various higher-order functions for manipulating object members, as well as utility methods for determining deep equality, checking object types, and recursively inspecting objects. All recursive methods fully support cyclic structures.
Maddy is directly inspired by Functional, Underscore, and Ruby's Enumerable module, and philosophically by the FuseJS project.
The library is framework-agnostic, and is compatible with web browsers, CommonJS environments, JavaScript engines, and asynchronous script loaders. It also normalizes infamous bugs present in older environments, such as Internet Explorer 6 and Safari 2.
The development version is commented and uncompressed; the production version has been compressed using Closure Compiler with advanced optimizations enabled.
If you're a Node user, Maddy is available on npm:
$ npm install maddy
The annotated source code is available for your perusal.
Maddy has been tested with the following web browsers, CommonJS environments, and JavaScript engines.
- Windows Internet Explorer, version 6.0 and higher
- Mozilla Firefox, version 1.5 and higher
- Apple Safari, version 2.0 and higher
- Google Chrome, version 1.0 and higher
- Opera 7.54 and higher
- Mozilla 1.7.2, Netscape 7.2, and SeaMonkey 1.0 and higher
- Mozilla SpiderMonkey, version 1.5.0 and higher
- Mozilla Rhino 1.7R1 and higher
- WebKit JSC
- Google V8
Check out a working copy of the Maddy source code with Git:
$ git clone git://github.com/kitcambridge/maddy.git
If you'd like to contribute a feature or bug fix, you can fork Maddy, commit your changes, and send a pull request. Please make sure to update the unit tests in the tests
directory as well.
Alternatively, you can use the GitHub issue tracker to submit bug reports and feature requests.
Maddy uses the Spec unit testing framework. The unit tests are written in Coco, a self-hosting CoffeeScript dialect that compiles to JavaScript. Coco reduces the syntactic noise and idiomatic verbosity inherent in writing unit tests for a functional programming library.
Coco can be installed via npm or Git. Once you've installed the compiler, run coco -wc tests/tests.co
from the command line to watch and automatically recompile the unit tests as you modify them.
In addition to the following Prototype-inspired guidelines, please follow the conventions already established in the code.
- Spacing: Use two spaces for indentation. No tabs.
- Naming: Keep variable and method names concise but descriptive.
index
andcallback
are preferable toi
andfn
. - Functions: Use named function declarations to aid in debugging. Avoid anonymous functions and named function expressions.
- Comments: Significant changes and new methods should be annotated with comments.
- Lint: Make sure that your changes pass JavaScript Lint. A configuration file is included in the repository; to check the source code for problems, run
jsl -conf jsl.conf
.
Copyright © 2011-2012 Kit Cambridge.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.