Remove process._byteLength

v0.7.4-release
Ryan Dahl 2010-09-17 01:06:44 -07:00
parent 9628e28aec
commit 776754c33f
4 changed files with 6 additions and 28 deletions

View File

@ -994,17 +994,6 @@ Local<Value> ExecuteString(Local<String> source, Local<Value> filename) {
return scope.Close(result);
}
static Handle<Value> ByteLength(const Arguments& args) {
HandleScope scope;
if (args.Length() < 1 || !args[0]->IsString()) {
return ThrowException(Exception::Error(String::New("Bad argument.")));
}
Local<Integer> length = Integer::New(DecodeBytes(args[0], ParseEncoding(args[1], UTF8)));
return scope.Close(length);
}
static Handle<Value> Loop(const Arguments& args) {
HandleScope scope;
@ -1608,7 +1597,6 @@ static void Load(int argc, char *argv[]) {
// define various internal methods
NODE_SET_METHOD(process, "loop", Loop);
NODE_SET_METHOD(process, "compile", Compile);
NODE_SET_METHOD(process, "_byteLength", ByteLength);
NODE_SET_METHOD(process, "_needTickCallback", NeedTickCallback);
NODE_SET_METHOD(process, "reallyExit", Exit);
NODE_SET_METHOD(process, "chdir", Chdir);

View File

@ -21,6 +21,7 @@ process.unwatchFile = removed("process.unwatchFile() has moved to fs.unwatchFile
process.mixin = removed('process.mixin() has been removed.');
process.createChildProcess = removed("childProcess API has changed. See doc/api.txt.");
process.inherits = removed("process.inherits() has moved to sys.inherits.");
process._byteLength = removed("process._byteLength() has moved to Buffer.byteLength");
process.assert = function (x, msg) {
if (!x) throw new Error(msg || "assertion error");

View File

@ -318,3 +318,8 @@ assert.equal(sb, s);
b = new Buffer("abcde");
assert.equal("bcde", b.slice(1).toString());
// byte length
assert.equal(14, Buffer.byteLength("Il était tué"));
assert.equal(14, Buffer.byteLength("Il était tué", "utf8"));
assert.equal(12, Buffer.byteLength("Il était tué", "ascii"));
assert.equal(12, Buffer.byteLength("Il était tué", "binary"));

View File

@ -1,16 +0,0 @@
common = require("../common");
assert = common.assert
assert.equal(14, process._byteLength("Il était tué"));
assert.equal(14, process._byteLength("Il était tué", "utf8"));
assert.equal(12, process._byteLength("Il était tué", "ascii"));
assert.equal(12, process._byteLength("Il était tué", "binary"));
assert.throws(function() {
process._byteLength();
});
assert.throws(function() {
process._byteLength(5);
});