Standardize on es6 exports

This commit is contained in:
Jordan Eldredge 2017-01-17 17:43:38 -08:00
parent b9aa4fef71
commit 0872f5fad4
33 changed files with 38 additions and 46 deletions

View file

@ -1,6 +1,6 @@
module.exports = function(base) {
export default function(base) {
const supportsAudioApi = !!(base.AudioContext || base.webkitAudioContext);
const supportsCanvas = !!(base.document.createElement('canvas').getContext);
this.isCompatible = supportsAudioApi && supportsCanvas;
};
}

View file

@ -21,4 +21,4 @@ const mapDispatchToProps = (dispatch) => ({
stop: () => dispatch(stop())
});
module.exports = connect(mapStateToProps, mapDispatchToProps)(ActionButtons);
export default connect(mapStateToProps, mapDispatchToProps)(ActionButtons);

View file

@ -34,4 +34,4 @@ const mapDispatchToProps = (dispatch) => ({
hideMarquee: () => dispatch({type: UNSET_FOCUS})
});
module.exports = connect(mapStateToProps, mapDispatchToProps)(Balance);
export default connect(mapStateToProps, mapDispatchToProps)(Balance);

View file

@ -1,7 +1,7 @@
import React from 'react';
import Character from './Character';
module.exports = (props) => {
export default (props) => {
const text = `${props.children}`;
const chars = text.split('');
return <div {...props}>

View file

@ -16,4 +16,4 @@ const mapDispatchToProps = (dispatch) => ({
closeWinamp: () => dispatch(close())
});
module.exports = connect(mapStateToProps, mapDispatchToProps)(Close);
export default connect(mapStateToProps, mapDispatchToProps)(Close);

View file

@ -32,4 +32,4 @@ const mapDispatchToProps = (dispatch) => ({
}
});
module.exports = connect(mapStateToProps, mapDispatchToProps)(ClutterBar);
export default connect(mapStateToProps, mapDispatchToProps)(ClutterBar);

View file

@ -67,4 +67,4 @@ const mapDispatchToProps = (dispatch, ownProps) => ({
setSkin: (filename) => dispatch(setSkinFromFilename(filename))
});
module.exports = connect(mapStateToProps, mapDispatchToProps)(ContextMenu);
export default connect(mapStateToProps, mapDispatchToProps)(ContextMenu);

View file

@ -27,4 +27,4 @@ class DragTarget extends React.Component {
}
}
module.exports = DragTarget;
export default DragTarget;

View file

@ -14,4 +14,4 @@ const mapDispatchToProps = (dispatch, ownProps) => ({
openFileDialog: () => dispatch(openFileDialog(ownProps.fileInput))
});
module.exports = connect(() => ({}), mapDispatchToProps)(Eject);
export default connect(() => ({}), mapDispatchToProps)(Eject);

View file

@ -26,4 +26,4 @@ class EqAuto extends React.Component {
}
}
module.exports = connect((state) => state.equalizer)(EqAuto);
export default connect((state) => state.equalizer)(EqAuto);

View file

@ -26,4 +26,4 @@ class EqOn extends React.Component {
}
}
module.exports = connect((state) => state.equalizer)(EqOn);
export default connect((state) => state.equalizer)(EqOn);

View file

@ -21,4 +21,4 @@ const mapDispatchToProps = (dispatch) => ({
});
module.exports = connect(mapStateToProps, mapDispatchToProps)(EqToggleButton);
export default connect(mapStateToProps, mapDispatchToProps)(EqToggleButton);

View file

@ -80,4 +80,4 @@ const mapDispatchToProps = (dispatch) => ({
dispatch
});
module.exports = connect((state) => state, mapDispatchToProps)(EqualizerWindow);
export default connect((state) => state, mapDispatchToProps)(EqualizerWindow);

View file

@ -8,4 +8,4 @@ const Kbps = (props) => <CharacterString id='kbps'>
{props.kbps}
</CharacterString>;
module.exports = connect((state) => state.media)(Kbps);
export default connect((state) => state.media)(Kbps);

View file

@ -8,4 +8,4 @@ const Khz = (props) => <CharacterString id='khz'>
{props.khz}
</CharacterString>;
module.exports = connect((state) => state.media)(Khz);
export default connect((state) => state.media)(Khz);

View file

@ -8,4 +8,4 @@ const MonoStereo = (props) => <div className='mono-stereo'>
<div id='mono' className={classnames({selected: props.channels === 1})} />
</div>;
module.exports = connect((state) => state.media)(MonoStereo);
export default connect((state) => state.media)(MonoStereo);

View file

@ -32,4 +32,4 @@ const PlaylistWindow = (props) => {
);
};
module.exports = connect((state) => state.display.skinPlaylistStyle)(PlaylistWindow);
export default connect((state) => state.display.skinPlaylistStyle)(PlaylistWindow);

View file

@ -57,4 +57,4 @@ const mapDispatchToProps = (dispatch) => ({
}
});
module.exports = connect(mapStateToProps, mapDispatchToProps)(Position);
export default connect(mapStateToProps, mapDispatchToProps)(Position);

View file

@ -21,4 +21,4 @@ const mapDispatchToProps = (dispatch) => ({
handleClick: () => dispatch(toggleRepeat())
});
module.exports = connect(mapStateToProps, mapDispatchToProps)(Repeat);
export default connect(mapStateToProps, mapDispatchToProps)(Repeat);

View file

@ -9,4 +9,4 @@ const mapDispatchToProps = (dispatch) => ({
handleClick: () => dispatch({type: TOGGLE_SHADE_MODE})
});
module.exports = connect(() => ({}), mapDispatchToProps)(Shade);
export default connect(() => ({}), mapDispatchToProps)(Shade);

View file

@ -29,4 +29,4 @@ class Time extends React.Component {
}
}
module.exports = connect((state) => state.media)(Time);
export default connect((state) => state.media)(Time);

View file

@ -18,4 +18,4 @@ const mapStateToProps = (state) => ({
const mapDispatchToProps = (dispatch) => ({
handleClick: () => dispatch(toggleShuffle())
});
module.exports = connect(mapStateToProps, mapDispatchToProps)(Shuffle);
export default connect(mapStateToProps, mapDispatchToProps)(Shuffle);

View file

@ -168,4 +168,4 @@ const Skin = (props) => {
return <style type='text/css'>{cssRules.join('\n')}</style>;
};
module.exports = connect((state) => ({skinImages: state.display.skinImages}))(Skin);
export default connect((state) => ({skinImages: state.display.skinImages}))(Skin);

View file

@ -24,4 +24,4 @@ const mapDispatchToProps = (dispatch) => ({
toggleTimeMode: () => dispatch({type: TOGGLE_TIME_MODE})
});
module.exports = connect(mapStateToProps, mapDispatchToProps)(Time);
export default connect(mapStateToProps, mapDispatchToProps)(Time);

View file

@ -200,4 +200,4 @@ const mapDispatchToProps = (dispatch) => ({
toggleVisualizer: () => dispatch({type: TOGGLE_VISUALIZER_STYLE})
});
module.exports = connect(mapStateToProps, mapDispatchToProps)(Visualizer);
export default connect(mapStateToProps, mapDispatchToProps)(Visualizer);

View file

@ -36,4 +36,4 @@ const mapDispatchToProps = (dispatch) => ({
setVolume: (e) => dispatch(setVolume(e.target.value))
});
module.exports = connect(mapStateToProps, mapDispatchToProps)(Volume);
export default connect(mapStateToProps, mapDispatchToProps)(Volume);

View file

@ -140,4 +140,4 @@ class WindowManager extends React.Component {
);
}
}
module.exports = WindowManager;
export default WindowManager;

View file

@ -14,7 +14,7 @@ import {
TOGGLE_LLAMA_MODE
} from './actionTypes';
module.exports = function(winamp, {dispatch}) {
export default function(winamp, {dispatch}) {
let keylog = [];
const trigger = [
78, // N

View file

@ -2,7 +2,7 @@
import {BANDS} from './constants';
import MyFile from './myFile';
module.exports = {
export default {
_context: new (window.AudioContext || window.webkitAudioContext)(),
_source: null,
_buffer: null,

View file

@ -1,6 +1,6 @@
// Custom object representing a file
// `File` is already a builtin, so we use `MyFile`
module.exports = function() {
export default function() {
this.reader = new FileReader();
this.name = null;
this.url = null;

View file

@ -96,4 +96,4 @@ const parseSkin = (file) => getBufferFromFile(file)
.then(getSkinDataFromFiles)
.then(collectCssAndColors);
module.exports = parseSkin;
export default parseSkin;

View file

@ -1,4 +1,4 @@
const getTimeObj = (time) => {
export const getTimeObj = (time) => {
const minutes = Math.floor(time / 60);
const seconds = time % 60;
@ -10,7 +10,7 @@ const getTimeObj = (time) => {
};
};
const getTimeStr = (time) => {
export const getTimeStr = (time) => {
const timeObj = getTimeObj(time);
return [
timeObj.minutesFirstDigit,
@ -21,7 +21,7 @@ const getTimeStr = (time) => {
].join('');
};
const parseViscolors = (text) => {
export const parseViscolors = (text) => {
const entries = text.split('\n');
const regex = /^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/;
const colors = [];
@ -40,7 +40,7 @@ const parseViscolors = (text) => {
};
// Dumb ini parser that just gets all the key/value pairs
const parseIni = (text) => {
export const parseIni = (text) => {
const lines = text.split(/[\r\n]+/g);
const data = {};
lines.forEach((line) => {
@ -52,12 +52,4 @@ const parseIni = (text) => {
return data;
};
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
module.exports = {
getTimeObj,
getTimeStr,
parseViscolors,
parseIni,
clamp
};
export const clamp = (value, min, max) => Math.min(Math.max(value, min), max);

View file

@ -14,7 +14,7 @@ const fileInput = document.createElement('input');
fileInput.type = 'file';
fileInput.style.display = 'none';
module.exports = {
export default {
media: Media.init(fileInput),
fileInput: fileInput,
init: function(options) {