{
"dependencies": {
"gulp": "^3.9.1",
"gulp-pug": "^3.3.0"
}
}
const gulp = require('gulp');
const pug = require('gulp-pug');
gulp.task('pug', () => gulp
.src('*.pug')
.pipe(pug({pretty: true))
.pipe(gulp.dest('.'))
);
doctype basic
html
body
input(type="text")
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">
<html>
<body>
<input type="text"/>
</body>
</html>
function simpleCompare(a, b) {
if (a === b) return true;
const t = getType(a);
if (t !== getType(b)) return false;
if (t === 'Array') {
if (a.length !== b.length) return false;
for (let i = 0, l = a.length; i < l; i++)
if (!simpleCompare(a[i], b[i])) return false;
return true;
}
if (t === 'Date') return a.toString() === b.toString();
if (t === 'Object') {
const keys = Object.keys(a);
if (keys.length !== Object.keys(b).length) return false;
for (const k of keys)
if (!simpleCompare(a[k], b[k])) return false;
return true;
}
return false;
}
function getType(obj) {
return Object.prototype.toString.call(obj).slice(8, -1);
}
class App extends React.Component {
render() {
return (
<div className='todoMain'>
<input className='val' ref={(input) => { this.inputAdd = input }} placeholder='Add a Task...' type='text' />
<input type='button' value='Add' onClick={this.handleAdd} />
<input type='button' value='Clear' onClick={this.handleRemove} />
{this.updState.map((n,i) => <div>
<div className='listElem' key={i}>
{n.value}
<input type='checkbox' ref={ref => refs.push(ref)}/>
</div>
</div>)}
</div>
);
}
}