Skip to content

Commit

Permalink
fix a bunch of spelling mistakes (#499)
Browse files Browse the repository at this point in the history
  • Loading branch information
hipstersmoothie authored and edi9999 committed Jul 30, 2018
1 parent d907c03 commit cc96e11
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ Jimp.PNG_FILTER_NONE; // 0
Jimp.PNG_FILTER_SUB; // 1
Jimp.PNG_FILTER_UP; // 2
Jimp.PNG_FILTER_AVERAGE; // 3
Jimp.PNG_FILTER_PAETH; // 4
Jimp.PNG_FILTER_PATH; // 4
```

## Advanced usage
Expand Down
2 changes: 1 addition & 1 deletion jimp.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ declare namespace Jimp {
static PNG_FILTER_SUB: number;
static PNG_FILTER_UP: number;
static PNG_FILTER_AVERAGE: number;
static PNG_FILTER_PAETH: number;
static PNG_FILTER_PATH: number;

// resize methods
static RESIZE_NEAREST_NEIGHBOR: string;
Expand Down
2 changes: 1 addition & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const PNG_FILTER_NONE = 0;
export const PNG_FILTER_SUB = 1;
export const PNG_FILTER_UP = 2;
export const PNG_FILTER_AVERAGE = 3;
export const PNG_FILTER_PAETH = 4;
export const PNG_FILTER_PATH = 4;

export const RESIZE_NEAREST_NEIGHBOR = 'nearestNeighbor';
export const RESIZE_BILINEAR = 'bilinearInterpolation';
Expand Down
4 changes: 2 additions & 2 deletions src/image-manipulation/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export function posterize(n, cb) {

if (n < 2) {
n = 2;
} // minumum of 2 levels
} // minimum of 2 levels

this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
x,
Expand Down Expand Up @@ -188,7 +188,7 @@ export const grayscale = greyscale;

/**
* Multiplies the opacity of each pixel by a factor between 0 and 1
* @param {number} f A number, the factor by wich to multiply the opacity of each pixel
* @param {number} f A number, the factor by which to multiply the opacity of each pixel
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp }this for chaining of methods
*/
Expand Down
8 changes: 4 additions & 4 deletions src/image-manipulation/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export function blur(r, cb) {
pa = (asum * mulSum) >>> shgSum;
this.bitmap.data[yi + 3] = pa;

// normalise alpha
// normalize alpha
if (pa > 255) {
this.bitmap.data[yi + 3] = 255;
}
Expand Down Expand Up @@ -210,8 +210,8 @@ export function dither565(cb) {
y,
idx
) {
const tressholdId = ((y & 3) << 2) + (x % 4);
const dither = rgb565Matrix[tressholdId];
const thresholdId = ((y & 3) << 2) + (x % 4);
const dither = rgb565Matrix[thresholdId];
this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);
this.bitmap.data[idx + 1] = Math.min(
this.bitmap.data[idx + 1] + dither,
Expand All @@ -235,7 +235,7 @@ export const dither16 = dither565;

/**
* Get an image's histogram
* @return {object} An object with an array of color occurence counts for each channel (r,g,b)
* @return {object} An object with an array of color occurrence counts for each channel (r,g,b)
*/
function histogram() {
const histogram = {
Expand Down
10 changes: 5 additions & 5 deletions src/image-manipulation/shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as constants from '../constants';

/**
* Rotates an image clockwise by a number of degrees rounded to the nearest 90 degrees. NB: 'this' must be a Jimp object.
* @param {number} deg the number of degress to rotate the image by
* @param {number} deg the number of degrees to rotate the image by
*/
function simpleRotate(deg) {
let i = Math.round(deg / 90) % 4;
Expand Down Expand Up @@ -39,8 +39,8 @@ function simpleRotate(deg) {
}

/**
* Rotates an image clockwise by an arbitary number of degrees. NB: 'this' must be a Jimp object.
* @param {number} deg the number of degress to rotate the image by
* Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.
* @param {number} deg the number of degrees to rotate the image by
* @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed
*/
function advancedRotate(deg, mode) {
Expand Down Expand Up @@ -152,8 +152,8 @@ function advancedRotate(deg, mode) {

/**
* Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.
* @param {number} deg the number of degress to rotate the image by
* @param {string|boolea} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed
* @param {number} deg the number of degrees to rotate the image by
* @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
Expand Down
26 changes: 13 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class Jimp extends EventEmitter {
this.emitMulti(methodName, 'error', err);
}

/* Nicely format Jimp object when sent to the console e.g. console.log(imgage) */
/* Nicely format Jimp object when sent to the console e.g. console.log(image) */
inspect() {
return (
'<Jimp ' +
Expand Down Expand Up @@ -590,7 +590,7 @@ class Jimp extends EventEmitter {

/**
* Generates a perceptual hash of the image <https://en.wikipedia.org/wiki/Perceptual_hashing>.
* @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimaal, 16 is hex, 64 is base 64). Defaults to 64.
* @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {string} a string representing the hash
*/
Expand Down Expand Up @@ -1075,27 +1075,27 @@ Jimp.loadFont = function(file, cb) {
* Helper to create Jimp methods that emit events before and after its execution.
* @param {string} methodName The name to be appended to Jimp prototype.
* @param {string} evName The event name to be called.
* It will be prefixed by `before-` and emited when on method call.
* It will be appended by `ed` and emited after the method run.
* It will be prefixed by `before-` and emitted when on method call.
* It will be appended by `ed` and emitted after the method run.
* @param {function} method A function implementing the method itself.
* It will also create a quiet version that will not emit events, to not
* mess the user code with many `changed` event calls. You can call with
* `methodName + "Quiet"`.
*
* The emited event comes with a object parameter to the listener with the
* The emitted event comes with a object parameter to the listener with the
* `methodName` as one attribute.
*/
function jimpEvMethod(methodName, evName, method) {
const evNameBefore = 'before-' + evName;
const evNameAfter = evName.replace(/e$/, '') + 'ed';

Jimp.prototype[methodName] = function(...args) {
let wrapedCb;
let wrappedCb;
const cb = args[method.length - 1];
const jimpInstance = this;

if (typeof cb === 'function') {
wrapedCb = function(...args) {
wrappedCb = function(...args) {
const [err, data] = args;

if (err) {
Expand All @@ -1108,9 +1108,9 @@ function jimpEvMethod(methodName, evName, method) {

cb.apply(this, args);
};
args[args.length - 1] = wrapedCb;
args[args.length - 1] = wrappedCb;
} else {
wrapedCb = false;
wrappedCb = false;
}

this.emitMulti(methodName, evNameBefore);
Expand All @@ -1120,7 +1120,7 @@ function jimpEvMethod(methodName, evName, method) {
try {
result = method.apply(this, args);

if (!wrapedCb) {
if (!wrappedCb) {
this.emitMulti(methodName, evNameAfter, {
[methodName]: result
});
Expand Down Expand Up @@ -1185,9 +1185,9 @@ jimpEvChange('background', function(hex, cb) {
});

/**
* Scanes through a region of the bitmap, calling a function for each pixel.
* Scans through a region of the bitmap, calling a function for each pixel.
* @param {number} x the x coordinate to begin the scan at
* @param {number} y the y coordiante to begin the scan at
* @param {number} y the y coordinate to begin the scan at
* @param w the width of the scan region
* @param h the height of the scan region
* @param f a function to call on even pixel; the (x, y) position of the pixel
Expand Down Expand Up @@ -1231,7 +1231,7 @@ jimpEvChange('scan', function(x, y, w, h, f, cb) {
/**
* Crops the image at a given point to a give size
* @param {number} x the x coordinate to crop form
* @param {number} y the y coordiante to crop form
* @param {number} y the y coordinate to crop form
* @param w the width of the crop region
* @param h the height of the crop region
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
Expand Down
2 changes: 1 addition & 1 deletion src/modules/resize.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ Resize.prototype.resize = function(buffer) {
};

Resize.prototype.bypassResizer = function(buffer) {
// Just return the buffer passsed:
// Just return the buffer passed:
return buffer;
};

Expand Down
6 changes: 3 additions & 3 deletions src/modules/resize2.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,16 @@ module.exports = {
for (let x = 0; x < wM; x++) {
const xPos = j * wM + x;
const xyPos = (yPos * wDst2 + xPos) * 4;
const pixelAplha = buf2[xyPos + 3];
const pixelAlpha = buf2[xyPos + 3];

if (pixelAplha) {
if (pixelAlpha) {
r += buf2[xyPos];
g += buf2[xyPos + 1];
b += buf2[xyPos + 2];
realColors++;
}

a += pixelAplha;
a += pixelAlpha;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/image-bitmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import UTIF from 'utif';
import EXIFParser from 'exif-parser';
import GIF from 'omggif';

import * as MIME from '../utils/mime';
import * as constants from '../constants';
import { throwError } from './error-checking';
import * as MIME from './mime';
import promisify from './promisify';

function getMIMEFromBuffer(buffer, path) {
Expand Down
2 changes: 1 addition & 1 deletion tools/browser-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ if (!module.parent) {
throw new Error(
`Unknown command given. Run "$ ${
process.argv[1]
} help" for more inforation`
} help" for more information`
);
}
}
Expand Down

0 comments on commit cc96e11

Please sign in to comment.