Conditions | 1 |
Paths | 1 |
Total Lines | 52 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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'; |
||
4 | constructor( options ) { |
||
5 | super( options ); |
||
6 | |||
7 | this.controlOptions = { |
||
8 | control: { |
||
9 | title: 'Padding', |
||
10 | name: 'padding', |
||
11 | units: { |
||
12 | enabled: [ 'px', 'em', '%' ] |
||
13 | }, |
||
14 | sliders: [ |
||
15 | { name: 'top', label: 'Top', cssProperty: 'padding-top' }, |
||
16 | { name: 'right', label: 'Right', cssProperty: 'padding-right' }, |
||
17 | { name: 'bottom', label: 'Bottom', cssProperty: 'padding-bottom' }, |
||
18 | { name: 'left', label: 'Left', cssProperty: 'padding-left' } |
||
19 | ] |
||
20 | }, |
||
21 | setting: { |
||
22 | css: '', |
||
23 | settings: [ |
||
24 | { |
||
25 | media: [ 'base', 'phone', 'tablet', 'desktop', 'large' ], |
||
26 | unit: 'em', |
||
27 | isLinked: false, |
||
28 | values: { |
||
29 | top: 0, |
||
30 | right: 0, |
||
31 | bottom: 0, |
||
32 | left: 0 |
||
33 | } |
||
34 | } |
||
35 | ] |
||
36 | }, |
||
37 | slider: { |
||
38 | px: { |
||
39 | min: 0, |
||
40 | max: 100, |
||
41 | step: 1 |
||
42 | }, |
||
43 | '%': { |
||
44 | min: 0, |
||
45 | max: 20, |
||
46 | step: 0.1 |
||
47 | }, |
||
48 | em: { |
||
49 | min: 0, |
||
50 | max: 5, |
||
51 | step: 0.1 |
||
52 | } |
||
53 | } |
||
54 | }; |
||
55 | } |
||
56 | } |
||
59 |