https://github.com/cloudhead/rig.js
temporally extend an object's capabilities.
https://github.com/cloudhead/rig.js
Last synced: 11 months ago
JSON representation
temporally extend an object's capabilities.
- Host: GitHub
- URL: https://github.com/cloudhead/rig.js
- Owner: cloudhead
- License: mit
- Created: 2009-12-10T04:38:55.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2009-12-10T15:36:29.000Z (over 16 years ago)
- Last Synced: 2025-03-26T09:11:35.766Z (12 months ago)
- Language: JavaScript
- Homepage:
- Size: 69.3 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
rig.js
======
Temporally extend an object's capabilities.
synopsis
--------
Create a rig
var $ = rig.builder({
'string' : {
capitalize: function () {
return this.charAt(0).toUpperCase() + this.substr(1);
}
},
'array' : {
compact: function () {
var result = [];
for (var i = 0; i < this.length; i++) {
if (this[i]) result.push(this[i]);
}
return result;
}
}
});
Apply it to a couple objects to use the new functionality
$("rig").capitalize(); // "Rig"
$(["hello", "", "world", ""]).compact(); // ["hello", "world"]