提交 1166dc1a 编写于 作者: Z zengyawen

update docs

Signed-off-by: Nzengyawen <zengyawen1@huawei.com>
上级 3e44d2a5
...@@ -193,8 +193,8 @@ Calls back an asynchronous function. In the callback, the first parameter indica ...@@ -193,8 +193,8 @@ Calls back an asynchronous function. In the callback, the first parameter indica
} }
var cb = util.callbackWrapper(promiseFn); var cb = util.callbackWrapper(promiseFn);
cb((err, ret) => { cb((err, ret) => {
expect(err).strictEqual('value'); console.log(err);
expect(ret).strictEqual(undefined); console.log(ret);
}) })
``` ```
...@@ -259,7 +259,7 @@ Processes an asynchronous function and returns a promise version. ...@@ -259,7 +259,7 @@ Processes an asynchronous function and returns a promise version.
} }
let newPromiseObj = util.promiseWrapper(aysnFun)("Hello", 'World'); let newPromiseObj = util.promiseWrapper(aysnFun)("Hello", 'World');
newPromiseObj.then(res => { newPromiseObj.then(res => {
expect(res).strictEqual('HelloWorld'); console.log(res);
}) })
``` ```
...@@ -3054,7 +3054,7 @@ Encodes the input content asynchronously. ...@@ -3054,7 +3054,7 @@ Encodes the input content asynchronously.
var rarray = new Uint8Array([99,122,69,122]); var rarray = new Uint8Array([99,122,69,122]);
await that.encode(array).then(val=>{ await that.encode(array).then(val=>{
for (var i = 0; i < rarray.length; i++) { for (var i = 0; i < rarray.length; i++) {
expect(val[i]).assertEqual(rarray[i]) console.log(val[i])
} }
}) })
done(); done();
...@@ -3115,7 +3115,7 @@ Encodes the input content asynchronously into a string. ...@@ -3115,7 +3115,7 @@ Encodes the input content asynchronously into a string.
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
await that.encodeToString(array).then(val=>{ await that.encodeToString(array).then(val=>{
expect(val).assertEqual('czEz') console.log(val)
}) })
done(); done();
``` ```
...@@ -3177,7 +3177,7 @@ Decodes the input content asynchronously. ...@@ -3177,7 +3177,7 @@ Decodes the input content asynchronously.
var rarray = new Uint8Array([115,49,51]); var rarray = new Uint8Array([115,49,51]);
await that.decode(array).then(val=>{ await that.decode(array).then(val=>{
for (var i = 0; i < rarray.length; i++) { for (var i = 0; i < rarray.length; i++) {
expect(val[i]).assertEqual(rarray[i]) console.log(val[i])
} }
}) })
done(); done();
...@@ -5174,4 +5174,3 @@ Checks whether the input value is of the **WeakSet** type. ...@@ -5174,4 +5174,3 @@ Checks whether the input value is of the **WeakSet** type.
var result = that.isWeakSet(new WeakSet()); var result = that.isWeakSet(new WeakSet());
``` ```
...@@ -86,8 +86,8 @@ callbackWrapper(original: Function): (err: Object, value: Object )=&gt;void ...@@ -86,8 +86,8 @@ callbackWrapper(original: Function): (err: Object, value: Object )=&gt;void
} }
var cb = util.callbackWrapper(promiseFn); var cb = util.callbackWrapper(promiseFn);
cb((err, ret) => { cb((err, ret) => {
expect(err).strictEqual('value'); console.log(err);
expect(ret).strictEqual(undefined); console.log(ret);
}) })
``` ```
...@@ -119,7 +119,7 @@ promiseWrapper(original: (err: Object, value: Object) =&gt; void): Object ...@@ -119,7 +119,7 @@ promiseWrapper(original: (err: Object, value: Object) =&gt; void): Object
} }
let newPromiseObj = util.promiseWrapper(aysnFun)("Hello", 'World'); let newPromiseObj = util.promiseWrapper(aysnFun)("Hello", 'World');
newPromiseObj.then(res => { newPromiseObj.then(res => {
expect(res).strictEqual('HelloWorld'); console.log(res);
}) })
``` ```
...@@ -1426,7 +1426,7 @@ encode(src:Uint8Array):Promise&lt;Uint8Array&gt; ...@@ -1426,7 +1426,7 @@ encode(src:Uint8Array):Promise&lt;Uint8Array&gt;
var rarray = new Uint8Array([99,122,69,122]); var rarray = new Uint8Array([99,122,69,122]);
that.encode(array).then(val=>{ that.encode(array).then(val=>{
for (var i = 0; i < rarray.length; i++) { for (var i = 0; i < rarray.length; i++) {
expect(val[i]).assertEqual(rarray[i]) console.log(val[i])
} }
}) })
``` ```
...@@ -1453,7 +1453,7 @@ encodeToString(src:Uint8Array):Promise&lt;string&gt; ...@@ -1453,7 +1453,7 @@ encodeToString(src:Uint8Array):Promise&lt;string&gt;
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
that.encodeToString(array).then(val=>{ that.encodeToString(array).then(val=>{
expect(val).assertEqual('czEz') console.log(val)
}) })
``` ```
...@@ -1481,7 +1481,7 @@ decode(src:Uint8Array | string):Promise&lt;Uint8Array&gt; ...@@ -1481,7 +1481,7 @@ decode(src:Uint8Array | string):Promise&lt;Uint8Array&gt;
var rarray = new Uint8Array([115,49,51]); var rarray = new Uint8Array([115,49,51]);
that.decode(array).then(val=>{ that.decode(array).then(val=>{
for (var i = 0; i < rarray.length; i++) { for (var i = 0; i < rarray.length; i++) {
expect(val[i]).assertEqual(rarray[i]) console.log(val[i])
} }
}) })
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册