mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
refactor(hash) hash.create -> hash
This commit is contained in:
parent
8e3f7469ed
commit
622849d233
2 changed files with 9 additions and 9 deletions
|
|
@ -1,11 +1,11 @@
|
|||
(function (object) {
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var util = require('util'),
|
||||
crypto = require('crypto'),
|
||||
Writable = require('stream').Writable;
|
||||
|
||||
object.create = function() {
|
||||
module.exports = function() {
|
||||
var ret;
|
||||
|
||||
if (Writable) {
|
||||
|
|
@ -33,4 +33,4 @@
|
|||
};
|
||||
}
|
||||
|
||||
})(this);
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@
|
|||
DIR_SERVER = DIR + 'server/',
|
||||
pipe = require(DIR_SERVER + 'pipe'),
|
||||
flop = require(DIR_SERVER + 'flop'),
|
||||
Hash = require(DIR_SERVER + 'hash'),
|
||||
hash = require(DIR_SERVER + 'hash'),
|
||||
mellow = require(DIR_SERVER + 'mellow'),
|
||||
beautify = require(DIR_SERVER + 'beautify'),
|
||||
Util = require(DIR + 'util');
|
||||
|
||||
module.exports = function(query, name, callback) {
|
||||
var hash, error;
|
||||
var hashStream, error;
|
||||
|
||||
Util.checkArgs(arguments, ['query', 'name', 'callback']);
|
||||
|
||||
|
|
@ -34,17 +34,17 @@
|
|||
break;
|
||||
|
||||
case 'hash':
|
||||
hash = Hash.create();
|
||||
hashStream = hash();
|
||||
|
||||
if (!hash) {
|
||||
if (!hashStream) {
|
||||
error = 'hash: not suported, try update node';
|
||||
callback(Error(error));
|
||||
} else
|
||||
pipe.create(name, hash, function (error) {
|
||||
pipe.create(name, hashStream, function (error) {
|
||||
var hex;
|
||||
|
||||
if (!error)
|
||||
hex = hash.get();
|
||||
hex = hashStream.get();
|
||||
|
||||
callback(error, hex);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue