Skip to content

Commit

Permalink
#17 adding ESDoc configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
dortegau committed Jun 1, 2018
1 parent 03d98a7 commit 899f468
Show file tree
Hide file tree
Showing 7 changed files with 849 additions and 43 deletions.
5 changes: 5 additions & 0 deletions .esdoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"source": "./src",
"destination": "./docs",
"plugins": [{"name": "esdoc-standard-plugin"}]
}
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
### IntelliJ ###
### Node.js ###
node_modules

*.iml
.idea
### ESDoc ###
docs/

### ANSIBLE ###
### Ansible ###
*.retry
.galaxy_install_info
*/roles
Expand All @@ -16,3 +17,4 @@

### Build ###
deps
build
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ install:
- pip install molecule==1.25.0
- pip install docker
script:
- travis_wait 30 molecule test --driver docker
- travis_wait 60 molecule test --driver docker
deploy:
provider: npm
email: labs@idealista.com
Expand Down
9 changes: 8 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = function(grunt) {
// project configuration
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
jshint : {
Expand All @@ -19,11 +18,19 @@ module.exports = function(grunt) {
}
}
}
},
esdoc: {
compile: {
options: {
config: ".esdoc.json"
}
}
}
});

grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks("grunt-plugin-esdoc");

// default task(s)
grunt.registerTask('default', ['jshint', 'nodeunit:local']);
Expand Down
25 changes: 13 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,23 @@ var Thumb = function(input) {
module.exports = Thumb;

Thumb.prototype.resize = function(width, height) {
if (isPositiveOrZeroInteger(width)){
this.options.width = width;
} else {
throw new Error('Invalid width ' + width);
if (!isPositiveOrZeroInteger(width)) {
throw new Error('Invalid width: ' + width + '. Width should be >= 0');
}
if (isPositiveOrZeroInteger(height)){
this.options.height = height;
} else {
throw new Error('Invalid height ' + height);

if (!isPositiveOrZeroInteger(height)) {
throw new Error('Invalid height: ' + height + '. Height should be >= 0');
}

this.options.width = width;
this.options.height = height;

return this;
};

Thumb.prototype.rotate = function(angle) {
if (!isValidAngle(angle)) {
throw new Error('Unsupported angle (0, 90, 180, 270) ' + angle);
throw new Error('Unsupported angle: ' + angle + '. Supported values are (0, 90, 180, 270)');
}

this.options.rotate = angle;
Expand All @@ -52,7 +53,7 @@ Thumb.prototype.rotate = function(angle) {

Thumb.prototype.quality = function(quality) {
if (!isValidQuality(quality)) {
throw new Error('Invalid quality (1 -100) ' + quality);
throw new Error('Invalid quality: ' + quality + '. Valid quality value should be in the range [0-100]');
}

this.options.quality = quality;
Expand All @@ -61,7 +62,7 @@ Thumb.prototype.quality = function(quality) {

Thumb.prototype.adjust = function(adjust) {
if (!isValidAdjust(adjust)) {
throw new Error('Invalid adjust (wi, he) ' + adjust);
throw new Error('Invalid adjust: ' + adjust + '. Adjust valid values are (wi, he)');
}

this.options.adjust = adjust;
Expand All @@ -70,7 +71,7 @@ Thumb.prototype.adjust = function(adjust) {

Thumb.prototype.crop = function(crop) {
if (!isValidCrop(crop)) {
throw new Error('Invalid crop (true,false) ' + crop);
throw new Error('Invalid crop: ' + crop + '. Crop valid values are (true,false)');
}

this.options.crop = crop;
Expand Down
Loading

0 comments on commit 899f468

Please sign in to comment.