|
1 | 1 | # modelate |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | +[](https://travis-ci.org/CodingCarlos/modelate) |
| 7 | + |
2 | 8 | A data modeling tool for NodeJS. It's 100% database agnostic, and 100% customizable. |
3 | 9 |
|
4 | 10 | # How does it work? |
@@ -60,7 +66,7 @@ Check data length. It uses default .length param, so it's valid for so much type |
60 | 66 | ```javascript |
61 | 67 | { |
62 | 68 | length: { |
63 | | - eq: Number, // Exact allowed value |
| 69 | + eq: Number, // Exact allowed value |
64 | 70 | max: Number, // Maximum allowed value |
65 | 71 | min: Number // Minimum allowed value |
66 | 72 | } |
@@ -93,11 +99,11 @@ Use a custom function to check at your own criteria. The only necessary thing is |
93 | 99 | The function might look like this: |
94 | 100 | ```javascript |
95 | 101 | function is42(value) { |
96 | | - var allowed = [42, '42', 'cuarenta y dos', 'fourty two', 'the answer to the life the universe and everything']; |
97 | | - if(allowedValues.indexOf(value) === -1) { |
98 | | - return false; |
99 | | - } |
100 | | - return true; |
| 102 | + var allowed = [42, '42', 'cuarenta y dos', 'fourty two', 'the answer to the life the universe and everything']; |
| 103 | + if (allowedValues.indexOf(value) === -1) { |
| 104 | + return false; |
| 105 | + } |
| 106 | + return true; |
101 | 107 | } |
102 | 108 | ``` |
103 | 109 |
|
@@ -145,13 +151,57 @@ var geopoint = Modelate('Geopoint').set({ |
145 | 151 |
|
146 | 152 | // Now, you can validate Geopoint objects ^^ |
147 | 153 | var myGeopoint = { |
148 | | - name: 'Batman Symbol' |
| 154 | + name: 'Batman Symbol', |
149 | 155 | coords: { |
150 | 156 | lat: 26.357896, |
151 | 157 | long: 127.783809 |
152 | 158 | } |
153 | | -} |
| 159 | +}; |
154 | 160 |
|
155 | 161 | var batman = geopoint.modelate(myGeopoint); |
156 | 162 | console.log(batman); |
157 | 163 | ``` |
| 164 | +
|
| 165 | +# Tests |
| 166 | +
|
| 167 | +I'm currently adding tests to this code. I'm using Jasmine, and saving tests in `/spec` folder. |
| 168 | +
|
| 169 | +To run tests, just execute: |
| 170 | +``` |
| 171 | +npm test |
| 172 | +``` |
| 173 | +
|
| 174 | +First time you run tests, you might need to install Jasmine, and other possible test dependencies. To do it fastly, just execute: |
| 175 | +``` |
| 176 | +npm install |
| 177 | +``` |
| 178 | +
|
| 179 | +And now you can run tests ^^ |
| 180 | +
|
| 181 | +## Test coverage: |
| 182 | +Master version might not have the last test updates. Check out the `develop` branch to see the last updates. Also, the actual test coverage (in `develop` branch) is fully referenced in #3 issue. |
| 183 | +
|
| 184 | + - [ ] Core |
| 185 | + - [x] Exported module |
| 186 | + - [x] Model |
| 187 | + - [x] Modelate |
| 188 | + - [ ] Validate |
| 189 | + - [ ] Validators |
| 190 | + - [ ] Type |
| 191 | + - [ ] Length |
| 192 | + - [ ] Value |
| 193 | + - [ ] Custom function |
| 194 | + - [ ] Date |
| 195 | + - [ ] Model |
| 196 | +
|
| 197 | +# Contribute |
| 198 | +You can use this code as you like. If you find a bug, or want to ask for a feature, just open an issue, and we'll do our best. If you can fix it, do a pull request to dev branch, and we promise to review it as fast as possible to merge it. |
| 199 | +
|
| 200 | +If you are new on this open source world, here is a short guide about how to make a pull request to contribute: |
| 201 | +
|
| 202 | + 1. Fork then clone `git clone git@github.com:your-username/modelate.git` **CodingCarlos/modelate** repository. |
| 203 | + 2. Create a new branch in **your personal forked repo**, with a name similar to your edits, such as `fix-whatever`. |
| 204 | + 3. Make your edits inside your new branch. |
| 205 | + 4. Commit them and push them back to **your personal github fork**. |
| 206 | + 5. Make a new Pull Request on the **CodingCarlos/modelate** repo. Point your branch to the `dev` `CodingCarlos/modelate`'s branch and submit. |
| 207 | + 6. We will do my best to review and accept the code as soon as possible. |
0 commit comments