-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
2,170 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
"typecheck", "syntax-flow", "transform-flow-strip-types" | ||
], | ||
"sourceMaps": "both", | ||
"presets": ["es2015", "stage-1"] | ||
} |
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,16 @@ | ||
{ | ||
"extends": "airbnb/base", | ||
"parser": "babel-eslint", | ||
"rules": { | ||
"no-console": 0, | ||
"max-len": [1, 120, 2], | ||
"no-param-reassign": [2, { "props": false }], | ||
"no-continue": 0, | ||
"no-underscore-dangle": 0, | ||
"generator-star-spacing": 0, | ||
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true } ] | ||
}, | ||
"env": { | ||
"jest": true | ||
} | ||
} |
Empty file.
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,41 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
.idea | ||
|
||
yarn.lock |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 Quanto | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,77 @@ | ||
____ _ ___ _ | ||
/ ___|___ _ __ | |_ __ _ / _ \ _ _ __ _ _ __ | |_ ___ | ||
| | / _ \| '_ \| __/ _` | | | | | | |/ _` | '_ \| __/ _ \ | ||
| |__| (_) | | | | || (_| | |_| | |_| | (_| | | | | || (_) | | ||
\____\___/|_| |_|\__\__,_|\__\_\\__,_|\__,_|_| |_|\__\___/ | ||
|
||
Welcome to the Quanto Commons repository! | ||
These are tools / constants / models that are shared among | ||
our projects. Feel free to contribute / make it better. | ||
|
||
|
||
## QuantoColors | ||
|
||
`QuantoColors` uses the `node-colors` package and makes a standard color | ||
display over our applications. To use it just import `QuantoColors` from | ||
`quanto-commons` and run it: | ||
|
||
```javascript | ||
import { QuantoColors } from 'quanto-commons'; | ||
|
||
QuantoColors(); | ||
``` | ||
Then you should be able to use like this in any string: | ||
|
||
```javascript | ||
const myRainbowString = 'This is my rainbow string'.rainbow; | ||
console.log(myRainbowString); | ||
``` | ||
|
||
should output: | ||
|
||
 | ||
|
||
|
||
The **current** usable color set is: | ||
|
||
* `silly` => `rainbow` | ||
* `input` => `grey` | ||
* `verbose` => `cyan` | ||
* `prompt` => `grey` | ||
* `info` => `green` | ||
* `data` => `grey` | ||
* `help` => `cyan` | ||
* `warn` => `yellow` | ||
* `debug` => `blue` | ||
* `error` => `red` | ||
|
||
## printQuantoHeader | ||
|
||
This call is used to print out headers like this: | ||
|
||
 | ||
|
||
To use it's very simple. | ||
|
||
```javascript | ||
import { printQuantoHeader } from 'quanto-commons'; | ||
|
||
printQuantoHeader('Quanto Commons', 'Test'); | ||
``` | ||
|
||
The second parameter is optional and denotes the second line. | ||
|
||
## ErrorObject / ErrorCodes | ||
|
||
The `ErrorObject` model is used across our applications to denote an | ||
error when returning or throwing an exception. It has five fields: | ||
|
||
* `errorCode` => A string from `ErrorCodes` | ||
* `stackTrace` => An optional string containing the stacktrace | ||
* `errorField` => An optional string containing the field related to the error | ||
* `message` => A brief message saying why the error ocurred | ||
* `errorDat` => An optional object that can contain extra data related to the error | ||
|
||
The `ErrorCodes` is a type of enum that contains a map from a standard errorCode string to | ||
a good name to be used on `ErrorObject` (or other places). |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.