Commit 4020690576aa690c14295869a4cb2c266a44811c
0 parents
Exists in
master
Added project files
Showing
3 changed files
with
64 additions
and
0 deletions
Show diff stats
1 | +++ a/LICENSE | ||
@@ -0,0 +1,19 @@ | @@ -0,0 +1,19 @@ | ||
1 | +Copyright (c) 2014-2014 Arcus Solutions | ||
2 | + | ||
3 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
4 | +of this software and associated documentation files (the "Software"), to deal | ||
5 | +in the Software without restriction, including without limitation the rights | ||
6 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
7 | +copies of the Software, and to permit persons to whom the Software is | ||
8 | +furnished to do so, subject to the following conditions: | ||
9 | + | ||
10 | +The above copyright notice and this permission notice shall be included in | ||
11 | +all copies or substantial portions of the Software. | ||
12 | + | ||
13 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
15 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
16 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
17 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
18 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
19 | +THE SOFTWARE. |
1 | +++ a/lib/arcus-mutation.js | ||
@@ -0,0 +1,19 @@ | @@ -0,0 +1,19 @@ | ||
1 | +/** | ||
2 | + * Created by Michael Muesch on 8/24/2014. | ||
3 | + */ | ||
4 | + | ||
5 | +exports.generateMethods = function(object){ | ||
6 | + for(var key in object){ | ||
7 | + if(typeof object[key] != "function"){ | ||
8 | + (function(key){ | ||
9 | + var uppercaseKey = key.charAt(0).toUpperCase() + key.slice(1); | ||
10 | + object.constructor.prototype["get"+uppercaseKey] = function(){ | ||
11 | + return this[key]; | ||
12 | + }; | ||
13 | + object.constructor.prototype["set"+uppercaseKey] = function(value){ | ||
14 | + this[key] = value; | ||
15 | + }; | ||
16 | + })(key) | ||
17 | + } | ||
18 | + } | ||
19 | +}; | ||
0 | \ No newline at end of file | 20 | \ No newline at end of file |
1 | +++ a/package.json | ||
@@ -0,0 +1,26 @@ | @@ -0,0 +1,26 @@ | ||
1 | +{ | ||
2 | + "name": "arcus-mutation", | ||
3 | + "description": "Automatically generate default accessors and mutators for a class.", | ||
4 | + "main": "./lib/arcus-mutation", | ||
5 | + "author": { | ||
6 | + "name": "Michael Muesch" | ||
7 | + }, | ||
8 | + "version": "0.1.0", | ||
9 | + "repository": { | ||
10 | + "type": "git", | ||
11 | + "url": "https://github.com/ArcusSolutions/arcus-mutation.git" | ||
12 | + }, | ||
13 | + "bugs": { | ||
14 | + "url": "https://github.com/ArcusSolutions/arcus-mutation/issues" | ||
15 | + }, | ||
16 | + "licenses": [ | ||
17 | + { | ||
18 | + "type": "MIT", | ||
19 | + "url": "https://github.com/caolan/async/raw/master/LICENSE" | ||
20 | + } | ||
21 | + ], | ||
22 | + "readmeFilename": "README.md", | ||
23 | + "homepage": "https://github.com/ArcusSolutions/arcus-mutation", | ||
24 | + "_id": "arcus-mutation@0.1.0", | ||
25 | + "_from": "arcus-mutation@*" | ||
26 | +} |