Created
February 21, 2021 19:35
-
-
Save t0kio2/062648d0721bf06bb47ce2b7e0a229d4 to your computer and use it in GitHub Desktop.
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 React from 'react'; | |
import { connect } from 'react-redux'; | |
export const withBehavior = Component => connect()( | |
class extends React.Component { | |
func = () => console.log('this is hoc') | |
render() { | |
return ( | |
<Component | |
func={this.func} | |
/> | |
); | |
} | |
}, | |
); |
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
/** | |
* param "/first/second/../last" | |
* return "first" | |
*/ | |
export const getFirstPath = pathname => pathname.match(/^\/([^/]*).*$/)[1]; | |
/** | |
* param "/first/second/../last" | |
* return "last" | |
*/ | |
export const getLastPath = pathname => pathname.match(/([^/]+)\/?$/)[1]; | |
/** | |
* param 絵文字を含む文字列 | |
* return 絵文字を除外した文字列 | |
*/ | |
export const removeEmoji = (input) => { | |
const regEmoji = new RegExp(/[\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF]/, 'g'); | |
return input.replace(regEmoji, '') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment