Skip to content

Commit

Permalink
fix(vector): optimize jsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTelanie committed Aug 21, 2019
1 parent 9345857 commit de63a6e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
21 changes: 12 additions & 9 deletions src/point.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import {
} from './operator';
import formatNumber from './formatter';

/* eslint class-methods-use-this: 0 */
/* eslint-disable no-unused-vars */
/* eslint-disable no-dupe-keys */

const X = 0;
const Y = 1;
const AXES = Symbol('axes');
Expand Down Expand Up @@ -55,7 +51,7 @@ function square(val) {
*/
class APoint {
/**
* @param {number | (Alg)} x
* @param {number | Alg} x
* @param {number} [y]
* @hidden
*/
Expand Down Expand Up @@ -319,7 +315,7 @@ export class Point extends APoint {
}

/**
* @param {(point: APointType) => number} alg
* @param {(point: PointType) => number} alg
* @returns {this}
*/
calc(alg) {
Expand Down Expand Up @@ -368,19 +364,26 @@ const pointFactory = cachedFactory(Point);
* @typedef {(alg: Alg) => PointType} PointAlg
* @typedef {(x: number , y: number) => PointType} PointCon
* @typedef {PointAlg & PointCon} point
* @type {point}
*
* @param {number | Alg} x
* @param {number} [y]
* @returns {PointType}
* @hidden
*/
export function point(x, y) {
export const point = function point(x, y) {
return pointFactory(x, y);
}
};

const ipointFactory = cachedFactory(IPoint);

/**
* @typedef {(alg: Alg) => IPointType} IPointAlg
* @typedef {(x: number , y: number) => IPointType} IPointCon
* @typedef {IPointAlg & IPointCon}
*
* @param {number | Alg} x
* @param {number} [y]
* @returns {IPointType}
* @hidden
*/
export function ipoint(x, y) {
Expand Down
15 changes: 11 additions & 4 deletions src/vector.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import {
import formatNumber from './formatter';
import { ipoint } from './point';

/* eslint class-methods-use-this: 0 */
/* eslint-disable no-unused-vars */
/* eslint-disable no-dupe-keys */

const X = 0;
const Y = 1;
const Z = 2;
Expand All @@ -35,6 +31,7 @@ class AVector {
* @param {number | (Alg)} x
* @param {number} [y]
* @param {number} [z]
* @hidden
*/
constructor(x, y, z) {
if (typeof x === 'function') {
Expand Down Expand Up @@ -476,6 +473,11 @@ const vectorFactory = cachedFactory(Vector);
* @typedef {(alg: Alg) => VectorType} VectorAlg
* @typedef {(x: number , y: number, z: number) => VectorType} VectorCon
* @typedef {VectorAlg & VectorCon}
*
* @param {number | Alg} x
* @param {number} [y]
* @param {number} [z]
* @returns {VectorType}
* @hidden
*/
export function vector(x, y, z) {
Expand All @@ -488,6 +490,11 @@ const victorFactory = cachedFactory(Victor);
* @typedef {(alg: Alg) => VictorType} VictorAlg
* @typedef {(x: number , y: number, z: number) => VictorType} VictorCon
* @typedef {VictorAlg & VictorCon}
*
* @param {number | (Alg)} x
* @param {number} [y]
* @param {number} [z]
* @returns {VictorType}
* @hidden
*/
export function victor(x, y, z) {
Expand Down

0 comments on commit de63a6e

Please sign in to comment.