| Conditions | 1 |
| Paths | 1 |
| Total Lines | 60 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | import { MultiSlider } from '../multi-slider'; |
||
| 5 | constructor( options ) { |
||
| 6 | super( options ); |
||
| 7 | |||
| 8 | this.controlOptions = { |
||
| 9 | control: { |
||
| 10 | title: 'Border Radius', |
||
| 11 | name: 'border-radius', |
||
| 12 | units: { |
||
| 13 | enabled: [ 'px', 'em', '%' ] |
||
| 14 | }, |
||
| 15 | sliders: [ |
||
| 16 | { name: 'top-left', label: 'Top Left', cssProperty: 'border-top-left-radius' }, |
||
| 17 | { name: 'top-right', label: 'Top Right', cssProperty: 'border-top-right-radius' }, |
||
| 18 | { |
||
| 19 | name: 'bottom-right', |
||
| 20 | label: 'Bottom Right', |
||
| 21 | cssProperty: 'border-bottom-right-radius' |
||
| 22 | }, |
||
| 23 | { name: 'bottom-left', label: 'Bottom Left', cssProperty: 'border-bottom-left-radius' } |
||
| 24 | ] |
||
| 25 | }, |
||
| 26 | |||
| 27 | // Default settings for the control. |
||
| 28 | setting: { |
||
| 29 | css: '', |
||
| 30 | settings: [ |
||
| 31 | { |
||
| 32 | media: [ 'base', 'phone', 'tablet', 'desktop', 'large' ], |
||
| 33 | unit: 'px', |
||
| 34 | isLinked: false, |
||
| 35 | values: { |
||
| 36 | 'top-left': 0, |
||
| 37 | 'top-right': 0, |
||
| 38 | 'bottom-right': 0, |
||
| 39 | 'bottom-left': 0 |
||
| 40 | } |
||
| 41 | } |
||
| 42 | ] |
||
| 43 | }, |
||
| 44 | |||
| 45 | // Ranges for sliders. |
||
| 46 | slider: { |
||
| 47 | px: { |
||
| 48 | min: 0, |
||
| 49 | max: 50, |
||
| 50 | step: 1 |
||
| 51 | }, |
||
| 52 | em: { |
||
| 53 | step: 0.1, |
||
| 54 | min: 0, |
||
| 55 | max: 5 |
||
| 56 | }, |
||
| 57 | '%': { |
||
| 58 | min: 0, |
||
| 59 | max: 50, |
||
| 60 | step: 1 |
||
| 61 | } |
||
| 62 | } |
||
| 63 | }; |
||
| 64 | } |
||
| 65 | |||
| 94 |