Skip to content

Commit

Permalink
v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nic authored and racerxdl committed Oct 30, 2017
0 parents commit 4ba1f19
Show file tree
Hide file tree
Showing 30 changed files with 2,170 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .babelrc
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"]
}
16 changes: 16 additions & 0 deletions .eslintrc
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 added .flowconfig
Empty file.
41 changes: 41 additions & 0 deletions .gitignore
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
21 changes: 21 additions & 0 deletions LICENSE
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.
77 changes: 77 additions & 0 deletions README.md
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:

![Rainbow String](pics/rainbow-string.png)


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:

![Rainbow String](pics/quanto-header.png)

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).
96 changes: 96 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

117 changes: 117 additions & 0 deletions dist/models/ErrorCodes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4ba1f19

Please sign in to comment.