Skip to content

Commit

Permalink
make use of es6-shim
Browse files Browse the repository at this point in the history
It's mainly because of Object.setPrototypeOf()
  • Loading branch information
rlidwka committed Nov 12, 2014
1 parent 6a778e8 commit 037b3ae
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions index.js
@@ -1,3 +1,4 @@
require('es6-shim')
module.exports = require('./lib')

/**package
Expand Down
1 change: 1 addition & 0 deletions lib/cli.js
Expand Up @@ -7,6 +7,7 @@ if (process.getuid && process.getuid() === 0) {
}

process.title = 'sinopia'
require('es6-shim')

try {
// for debugging memory leaks
Expand Down
4 changes: 2 additions & 2 deletions lib/logger.js
Expand Up @@ -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
}

Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion lib/storage.js
Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions lib/streams.js
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
1 change: 1 addition & 0 deletions package.yaml
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions test/functional/index.js
@@ -1,3 +1,4 @@
require('es6-shim')
require('./lib/startup')

var assert = require('assert')
Expand Down

0 comments on commit 037b3ae

Please sign in to comment.