Skip to content

Commit

Permalink
fix(vector): reduce double code in jsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTelanie committed May 14, 2019
1 parent d528042 commit 9e9c947
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
9 changes: 3 additions & 6 deletions src/point.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ function square(val) {
}

/**
* @typedef {() => number} Alg
* @typedef {APoint & number} APointType
* @abstract
*/
class APoint {
/**
* @param {number | (() => number)} x
* @param {number | (Alg)} x
* @param {number} [y]
*/
constructor(x, y) {
Expand Down Expand Up @@ -320,15 +321,14 @@ export class IPoint extends APoint {
}

/**
* @param {() => number} alg
* @param {Alg} alg
* @return {PointType | IPointType}
*/
export function calc(alg) {
return operatorCalc(alg);
}

/**
* @typedef {() => number} Alg
* @typedef {(alg: Alg) => PointType} PointAlg
* @typedef {(x: number , y: number) => PointType} PointCon
* @typedef {PointAlg & PointCon} point
Expand All @@ -340,13 +340,10 @@ export const point = function point(x, y) {
};

/**
* @typedef {() => number} Alg
* @typedef {(alg: Alg) => IPointType} IPointAlg
* @typedef {(x: number , y: number) => IPointType} IPointCon
* @typedef {IPointAlg & IPointCon} ipoint
*
* @param {number} x
* @param {number} y
* @type {ipoint}
*/
export const ipoint = function ipoint(x, y) {
Expand Down
7 changes: 3 additions & 4 deletions src/vector.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ function square(val) {
}

/**
* @typedef {() => number} Alg
* @typedef {AVector & number} AVectorType
* @abstract
*/
class AVector {
/**
* @param {number | (() => number)} x
* @param {number | (Alg)} x
* @param {number} [y]
* @param {number} [z]
* @returns {AVectorType}
Expand Down Expand Up @@ -393,15 +394,14 @@ export class Victor extends AVector {
}

/**
* @param {() => number} alg
* @param {Alg} alg
* @return {VectorType | VictorType}
*/
export function calc(alg) {
return operatorCalc(alg);
}

/**
* @typedef {() => number} Alg
* @typedef {(alg: Alg) => VectorType} VectorAlg
* @typedef {(x: number , y: number, z: number) => VectorType} VectorCon
* @typedef {VectorAlg & VectorCon} vector
Expand All @@ -413,7 +413,6 @@ export const vector = function vector(x, y, z) {
};

/**
* @typedef {() => number} Alg
* @typedef {(alg: Alg) => VictorType} VictorAlg
* @typedef {(x: number , y: number, z: number) => VictorType} VictorCon
* @typedef {VictorAlg & VictorCon} victor
Expand Down

0 comments on commit 9e9c947

Please sign in to comment.