refact(es6): use es6 syntax.

* fixed #10, But iojs-2 not support Object.assign, so use object-assign
  shim instead for now.
* use es6 syntax.
* use eslint to instead jshint.
This commit is contained in:
闲耘™
2015-09-20 14:38:07 +08:00
parent eae25a474d
commit 36bd1d5202
14 changed files with 602 additions and 279 deletions

View File

@@ -1,8 +1,10 @@
var Benchmark = require('benchmark');
var benchmarks = require('beautify-benchmark');
var util = require('util');
'use strict';
var suite = new Benchmark.Suite();
const Benchmark = require('benchmark');
const benchmarks = require('beautify-benchmark');
const util = require('util');
const suite = new Benchmark.Suite();
function normal(text) {
if (arguments.length === 2) {
@@ -17,13 +19,13 @@ function normal(text) {
}
function apply() {
var args = Array.prototype.slice.call(arguments);
const args = Array.prototype.slice.call(arguments);
return util.format.apply(util, args);
}
function apply2() {
var args = new Array(arguments.length);
for (var i = 0, l = arguments.length; i < l; i++) {
const args = new Array(arguments.length);
for (let i = 0, l = arguments.length; i < l; i++) {
args[i] = arguments[i];
}
return util.format.apply(util, args);