make use of es6-shim

It's mainly because of Object.setPrototypeOf()
This commit is contained in:
Alex Kocharin 2014-11-12 15:05:07 +03:00
parent 6a778e8c17
commit 037b3aea6a
7 changed files with 9 additions and 5 deletions

View File

@ -1,3 +1,4 @@
require('es6-shim')
module.exports = require('./lib')
/**package

View File

@ -7,6 +7,7 @@ if (process.getuid && process.getuid() === 0) {
}
process.title = 'sinopia'
require('es6-shim')
try {
// for debugging memory leaks

View File

@ -95,7 +95,7 @@ for (var l in levels) {
}
function pad(str) {
if (str.length < max) return str + Array(max - str.length + 1).join(' ')
if (str.length < max) return str + ' '.repeat(max - str.length)
return str
}
@ -131,7 +131,7 @@ function print(type, msg, obj, colors) {
}
if (typeof(str) === 'string') {
if (!colors || ~str.indexOf('\n')) {
if (!colors || str.contains('\n')) {
return str
} else if (is_error) {
return '\033[31m' + str + '\033[39m'

View File

@ -462,7 +462,7 @@ Storage.prototype._sync_package_with_uplinks = function(name, pkginfo, options,
}
async.map(uplinks, function(up, cb) {
var _options = Object.create(options)
var _options = Object.assign({}, options)
if (Utils.is_object(pkginfo._uplinks[up.upname])) {
var fetched = pkginfo._uplinks[up.upname].fetched
if (fetched && fetched > (Date.now() - up.maxage)) {

View File

@ -9,7 +9,7 @@ module.exports.UploadTarballStream = UploadTarball
//
function ReadTarball(options) {
var self = new Stream.PassThrough(options)
self.__proto__ = ReadTarball.prototype
Object.setPrototypeOf(self, ReadTarball.prototype)
// called when data is not needed anymore
add_abstract_method(self, 'abort')
@ -24,7 +24,7 @@ Util.inherits(ReadTarball, Stream.PassThrough)
//
function UploadTarball(options) {
var self = new Stream.PassThrough(options)
self.__proto__ = UploadTarball.prototype
Object.setPrototypeOf(self, UploadTarball.prototype)
// called when user closes connection before upload finishes
add_abstract_method(self, 'abort')

View File

@ -25,6 +25,7 @@ dependencies:
cookies: '>=0.5.0 <1.0.0-0'
request: '>=2.31.0 <3.0.0-0'
async: '>=0.9.0 <1.0.0-0'
es6-shim: '>=0.20 <1.0.0-0'
# 2.x and 3.x have the same interface
semver: '>=2.2.1 <4.0.0-0'

View File

@ -1,3 +1,4 @@
require('es6-shim')
require('./lib/startup')
var assert = require('assert')