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 { of, itShouldProp, large, always } from 'OverAssert' | |
const data = { | |
age: 20 | |
}; | |
of(data) | |
.map(itShouldProp('age', large(10), always('age should large than 10'))) | |
.map(itShouldProp('age', less(80), always('age should less than 80'))) | |
.validation((success, reason) => { |
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
function submit(data) { | |
let errorMessage = ''; | |
if (!data.name) { | |
errorMessage = 'please input name'; | |
} else if (data.lastName && data.lastName.length > 10) { | |
errorMessage = 'length of lastName should less than 10 '; | |
} else if (data.age < 80) { |
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
"use strict" | |
let koa = require('koa'); | |
let Router = require('koa-router'); | |
let fs = require('fs'); | |
let assert = require('http-assert'); | |
let sscanf = require('scanf').sscanf; | |
let app = new koa(); | |
let router = new Router(); |
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 '../styles/index.scss'; | |
import { track, before, after, composeWith, evolve, time, identity, createCounter} from 'trackpoint-tools' | |
export default class App extends React.Component { | |
constructor () { | |
super() | |
this.name = 'app' | |
} |
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 createReactClass from 'create-react-class' | |
import cu from 'lodash/curry' | |
export default cu(function (title, Component) { | |
let oriTitle = document.title | |
return createReactClass({ | |
componentWillMount () { | |
oriTitle = document.title |
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
; autocomplete as javascript | |
(add-to-list 'ycmd-file-type-map '(react-mode . ("javascript"))) | |
(define-derived-mode react-mode web-mode "React-IDE" | |
"Major mode for react/jsx") | |
(add-hook 'react-mode-hook 'ycmd-mode) | |
(add-to-list 'auto-mode-alist '("\\.jsx" . react-mode)) |
NewerOlder