Skip to content

Commit

Permalink
Merge a503bdf into 9b8191a
Browse files Browse the repository at this point in the history
  • Loading branch information
knor-el-snor committed Dec 27, 2018
2 parents 9b8191a + a503bdf commit c57ba87
Show file tree
Hide file tree
Showing 8 changed files with 7,727 additions and 4,405 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ node_modules

# NPM
.npm
package-lock.json

# Yarn
.yarnclean
Expand Down
7 changes: 1 addition & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@ node_js:

sudo: false

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"

cache:
yarn: true
directories:
- "node_modules"

script:
- yarn run test:coverage
- npm run test:coverage

# Send coverage data to Coveralls
after_script: "cat coverage/lcov.info | node_modules/coveralls/bin/coveralls.js"
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ De/serialize json for consistency!

## Installation

```bash
$ npm install jsonade
``` shell
npm install jsonade
```


## Serializer

### `constructor`
Expand All @@ -42,11 +41,11 @@ Configuration:

Options:

- `case`: Convert the case of the keys of `data`
- `Undefined`: Doesn't convert the case
- `camelCase`: Converts keys to camelCase
- `snake_case`: Converts keys to snake_case
- `kebab-case`: Converts keys to kebab-case
- `case`: Convert the case of the keys of `data`
- `Undefined`: Doesn't convert the case
- `camelCase`: Converts keys to camelCase
- `snake_case`: Converts keys to snake_case
- `kebab-case`: Converts keys to kebab-case

#### Returns

Expand Down Expand Up @@ -74,7 +73,6 @@ Besides `totalCount`, `configuration ` may be used to extend the `meta` response

Returns a serialized data respresentation of the given data.


## ErrorSerializer

### `serialize`
Expand Down Expand Up @@ -103,7 +101,6 @@ Every error can have these properties:
| detail | optional |
| meta | optional |


##### Example

```json
Expand Down
2 changes: 1 addition & 1 deletion json-spec.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# iCapps - JSON request/response specification
# icapps - JSON request/response specification

## Goals

Expand Down
5 changes: 5 additions & 0 deletions lib/utils/data-construction.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ function getValue(data, key, config, options) {
return data[key].map(val => constructData(val, config[key]));
}

// If value is a mongoDB ID
if (new RegExp('^[0-9a-fA-F]{24}$').test(data[key])) {
return data[key];
}

return null;
}

Expand Down
Loading

0 comments on commit c57ba87

Please sign in to comment.