Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/qsPublic

Commit0485440

Browse files
committed
1 parenta54ca9e commit0485440

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"parallelshell":"^2.0.0",
3535
"qs-iconv":"^1.0.4",
3636
"safe-publish-latest":"^1.1.1",
37+
"safer-buffer":"^2.0.2",
3738
"tape":"^4.6.3"
3839
},
3940
"scripts": {

‎test/parse.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
vartest=require('tape');
44
varqs=require('../');
55
variconv=require('iconv-lite');
6+
varSaferBuffer=require('safer-buffer').Buffer;
67

78
test('parse()',function(t){
89
t.test('parses a simple string',function(st){
@@ -230,7 +231,7 @@ test('parse()', function (t) {
230231
});
231232

232233
t.test('parses buffers correctly',function(st){
233-
varb=newBuffer('test');
234+
varb=SaferBuffer.from('test');
234235
st.deepEqual(qs.parse({a:b}),{a:b});
235236
st.end();
236237
});
@@ -511,7 +512,7 @@ test('parse()', function (t) {
511512
result.push(parseInt(parts[1],16));
512513
parts=reg.exec(str);
513514
}
514-
returniconv.decode(newBuffer(result),'shift_jis').toString();
515+
returniconv.decode(SaferBuffer.from(result),'shift_jis').toString();
515516
}
516517
}),{:'大阪府'});
517518
st.end();

‎test/stringify.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
vartest=require('tape');
44
varqs=require('../');
55
variconv=require('iconv-lite');
6+
varSaferBuffer=require('safer-buffer').Buffer;
67

78
test('stringify()',function(t){
89
t.test('stringifies a querystring object',function(st){
@@ -325,8 +326,8 @@ test('stringify()', function (t) {
325326
});
326327

327328
t.test('stringifies buffer values',function(st){
328-
st.equal(qs.stringify({a:newBuffer('test')}),'a=test');
329-
st.equal(qs.stringify({a:{b:newBuffer('test')}}),'a%5Bb%5D=test');
329+
st.equal(qs.stringify({a:SaferBuffer.from('test')}),'a=test');
330+
st.equal(qs.stringify({a:{b:SaferBuffer.from('test')}}),'a%5Bb%5D=test');
330331
st.end();
331332
});
332333

@@ -460,7 +461,7 @@ test('stringify()', function (t) {
460461
});
461462

462463
t.test('can use custom encoder for a buffer object',{skip:typeofBuffer==='undefined'},function(st){
463-
st.equal(qs.stringify({a:newBuffer([1])},{
464+
st.equal(qs.stringify({a:SaferBuffer.from([1])},{
464465
encoder:function(buffer){
465466
if(typeofbuffer==='string'){
466467
returnbuffer;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp