This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { mapGetters } from "vuex"; | |
const curryMapGetters = args => (namespace, getters) => | |
Object.entries(mapGetters(namespace, getters)).reduce( | |
(acc, [getter, fn]) => ({ | |
...acc, | |
[getter]: state => | |
fn.call(state)(...(Array.isArray(args) ? args : [args])) | |
}), | |
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import set from 'lodash/set'; | |
import React from 'react'; | |
export default class extends React.Component { | |
setStateIn = (path, value, fn) => | |
this.setState(state => set(state, path, value), fn); | |
render = () => <div />; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dateStringtoObj = string => { | |
const [date, time, timezone] = string.split(/T|\+/g); | |
const [hours, minutes, seconds] = time.split(/:/g); | |
return { | |
date, | |
time, | |
timezone, | |
hours: parseInt(hours, 10), | |
minutes: parseInt(minutes, 10), | |
seconds: parseInt(seconds, 10), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createUrl = (path, params = {}) => | |
`${Object.keys(params).reduce( | |
(url, key) => url.replace(`:${key}`, params[key]), | |
path, | |
)}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class JSUtils { | |
regExpWithEscape (string) { | |
return new RegExp(string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CordovaMock { | |
constructor() { | |
this.platformId = 'ios'; | |
this.platformVersion = '4.3.1'; | |
this.plugins = { | |
}; | |
this.version = '4.3.1'; | |
} | |
require(id){} |