-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse functionality for different types of values
- Loading branch information
1 parent
7be1c3d
commit 0d3bb01
Showing
3 changed files
with
40 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
const SelectFields = require('./lib/select-fields'); | ||
const JoinFields = require('./lib/join-fields'); | ||
const DefaultValue = require('./lib/default-value'); | ||
const InsertFields = require('./lib/insert-fields'); | ||
const JoinFields = require('./lib/join-fields'); | ||
const ModelField = require('./lib/model-field'); | ||
const Parser = require('./lib/parse'); | ||
const PrivateFields = require('./lib/private-fields'); | ||
const QueryValues = require('./lib/query-values'); | ||
const SelectFields = require('./lib/select-fields'); | ||
const UpdateValues = require('./lib/update-values'); | ||
const DefaultValue = require('./lib/default-value'); | ||
const ValuesPointer = require('./lib/values-pointer'); | ||
const ModelField = require('./lib/model-field'); | ||
|
||
|
||
module.exports = { | ||
SelectFields, | ||
JoinFields, | ||
DefaultValue, | ||
InsertFields, | ||
JoinFields, | ||
ModelField, | ||
Parser, | ||
PrivateFields, | ||
QueryValues, | ||
SelectFields, | ||
UpdateValues, | ||
DefaultValue, | ||
ValuesPointer, | ||
ModelField | ||
ValuesPointer | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const parser = {}; | ||
|
||
|
||
parser.json = (data) => { | ||
return JSON.parse(data); | ||
}; | ||
|
||
parser.blob = (data) => { | ||
return Buffer.from(data, 'utf8'); | ||
}; | ||
|
||
|
||
const get = (type, data) => { | ||
if (!parser[type]) { | ||
return data; | ||
} | ||
|
||
const fn = parser[type]; | ||
return fn(data); | ||
}; | ||
|
||
|
||
module.exports = { | ||
get | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters