From 70918dcca0bf4df066c2efc3ea9a7f5f32e48460 Mon Sep 17 00:00:00 2001 From: Chen Fengyuan Date: Fri, 4 Oct 2019 12:35:19 +0800 Subject: [PATCH] style: fix eslint errors --- src/js/methods.js | 2 +- src/js/utilities.js | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/js/methods.js b/src/js/methods.js index d1d2dfb52..574ac2a71 100644 --- a/src/js/methods.js +++ b/src/js/methods.js @@ -773,7 +773,7 @@ export default { // All the numerical parameters should be integer for `drawImage` // https://github.com/fengyuanchen/cropper/issues/476 - context.drawImage(source, ...params.map(param => Math.floor(normalizeDecimalNumber(param)))); + context.drawImage(source, ...params.map((param) => Math.floor(normalizeDecimalNumber(param)))); return canvas; }, diff --git a/src/js/utilities.js b/src/js/utilities.js index 3f400b255..bb5c7c24c 100644 --- a/src/js/utilities.js +++ b/src/js/utilities.js @@ -19,7 +19,7 @@ export function isNumber(value) { * @param {*} value - The value to check. * @returns {boolean} Returns `true` if the given value is a positive number, else `false`. */ -export const isPositiveNumber = value => value > 0 && value < Infinity; +export const isPositiveNumber = (value) => value > 0 && value < Infinity; /** * Check if the given value is undefined. @@ -536,7 +536,7 @@ export function getTransforms({ * @returns {number} The result ratio. */ export function getMaxZoomRatio(pointers) { - const pointers2 = assign({}, pointers); + const pointers2 = { ...pointers }; const ratios = []; forEach(pointers, (pointer, pointerId) => { @@ -572,10 +572,11 @@ export function getPointer({ pageX, pageY }, endOnly) { endY: pageY, }; - return endOnly ? end : assign({ + return endOnly ? end : ({ startX: pageX, startY: pageY, - }, end); + ...end, + }); } /** @@ -755,7 +756,7 @@ export function getSourceCanvas( context.scale(scaleX, scaleY); context.imageSmoothingEnabled = imageSmoothingEnabled; context.imageSmoothingQuality = imageSmoothingQuality; - context.drawImage(image, ...params.map(param => Math.floor(normalizeDecimalNumber(param)))); + context.drawImage(image, ...params.map((param) => Math.floor(normalizeDecimalNumber(param)))); context.restore(); return canvas; }