1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/hustcc-variable-type

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
benchmark.js 1.2 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
hustcc Отправлено 19.10.2017 05:43 5c21ee1
/**
* Created by hustcc.
* Contract: i@hust.cc
*/
var Benchmark = require('benchmark');
var suite = new Benchmark.Suite();
var VT = require('./');
var PT = require('prop-types');
var obj = {
a: 1,
b: '2',
c: {
d: new Date(),
e: {
f: [4, 5, 6],
g: 'hustcc'
}
}
};
suite
.add('variable-type', function () {
VT.shape({
a: VT.number,
b: VT.string,
c: VT.shape({
d: VT.instanceOf(Date),
e: VT.shape({
f: VT.arrayOf(VT.number),
g: VT.string
})
})
}).check(obj);
})
.add('prop-types', function () {
PT.checkPropTypes(PT.shape({
a: PT.number.isRequired,
b: PT.string,
c: PT.shape({
d: PT.instanceOf(Date),
e: PT.shape({
f: PT.arrayOf(PT.number),
g: PT.string
})
})
}).isRequired, obj, 'props', 'MyComp');
})
.on('cycle', function (e) {
console.log('' + e.target);
})
.on('complete', function() {
var fast = this.filter('fastest');
var slow = this.filter('slowest');
console.log('[OPS] ' +
fast.map('name') + ' / ' + slow.map('name') +
' = ' +
(fast.map('hz') / slow.map('hz')).toFixed(3) +
'\n'
);
})
.run();

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/hustcc-variable-type.git
git@api.gitlife.ru:oschina-mirror/hustcc-variable-type.git
oschina-mirror
hustcc-variable-type
hustcc-variable-type
master