Skip to content

Commit 3915071

Browse files
committed
Rename variable
1 parent 257aacc commit 3915071

File tree

8 files changed

+46
-46
lines changed

8 files changed

+46
-46
lines changed

lib/node_modules/@stdlib/buffer/from-string/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# fromString
1+
# string2buffer
22

33
> Allocate a [buffer][@stdlib/buffer/ctor] containing a provided string.
44
@@ -17,22 +17,22 @@
1717
## Usage
1818

1919
```javascript
20-
var fromString = require( '@stdlib/buffer/from-string' );
20+
var string2buffer = require( '@stdlib/buffer/from-string' );
2121
```
2222

23-
#### fromString( str\[, encoding] )
23+
#### string2buffer( str\[, encoding] )
2424

2525
Allocates a [buffer][@stdlib/buffer/ctor] containing a provided `string`.
2626

2727
```javascript
28-
var buf = fromString( 'beep boop' );
28+
var buf = string2buffer( 'beep boop' );
2929
// returns <Buffer>
3030
```
3131

3232
The default character encoding is `utf8`. To specify an alternative encoding, provide an `encoding` argument.
3333

3434
```javascript
35-
var buf = fromString( '7468697320697320612074c3a97374', 'hex' );
35+
var buf = string2buffer( '7468697320697320612074c3a97374', 'hex' );
3636
// returns <Buffer>
3737
```
3838

@@ -70,10 +70,10 @@ The following `encodings` are supported:
7070
```javascript
7171
var randu = require( '@stdlib/random/base/randu' );
7272
var randint = require( '@stdlib/random/base/discrete-uniform' );
73-
var fromString = require( '@stdlib/buffer/from-string' );
73+
var string2buffer = require( '@stdlib/buffer/from-string' );
7474

7575
// Create a buffer from a string:
76-
var buf = fromString( 'beep boop bop' );
76+
var buf = string2buffer( 'beep boop bop' );
7777
console.log( buf.toString() );
7878

7979
// Generate random strings...

lib/node_modules/@stdlib/buffer/from-string/benchmark/benchmark.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
var bench = require( '@stdlib/bench' );
66
var isBuffer = require( '@stdlib/assert/is-buffer' );
77
var pkg = require( './../package.json' ).name;
8-
var fromString = require( './../lib' );
8+
var string2buffer = require( './../lib' );
99

1010

1111
// MAIN //
@@ -28,7 +28,7 @@ bench( pkg, function benchmark( b ) {
2828
b.tic();
2929
for ( i = 0; i < b.iterations; i++ ) {
3030
str = values[ i%values.length ];
31-
out = fromString( str );
31+
out = string2buffer( str );
3232
if ( out.length <= 0 ) {
3333
b.fail( 'should have a length greater than 0' );
3434
}
@@ -59,7 +59,7 @@ bench( pkg+':encoding=utf8', function benchmark( b ) {
5959
b.tic();
6060
for ( i = 0; i < b.iterations; i++ ) {
6161
str = values[ i%values.length ];
62-
out = fromString( str );
62+
out = string2buffer( str );
6363
if ( out.length <= 0 ) {
6464
b.fail( 'should have a length greater than 0' );
6565
}
@@ -88,7 +88,7 @@ bench( pkg+':encoding=hex', function benchmark( b ) {
8888
b.tic();
8989
for ( i = 0; i < b.iterations; i++ ) {
9090
str = values[ i%values.length ];
91-
out = fromString( str, 'hex' );
91+
out = string2buffer( str, 'hex' );
9292
if ( out.length <= 0 ) {
9393
b.fail( 'should have a length greater than 0' );
9494
}

lib/node_modules/@stdlib/buffer/from-string/benchmark/benchmark.length.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var bench = require( '@stdlib/bench' );
66
var pow = require( '@stdlib/math/base/special/pow' );
77
var isBuffer = require( '@stdlib/assert/is-buffer' );
88
var pkg = require( './../package.json' ).name;
9-
var fromString = require( './../lib' );
9+
var string2buffer = require( './../lib' );
1010

1111

1212
// FUNCTIONS //
@@ -40,7 +40,7 @@ function createBenchmark( len ) {
4040

4141
b.tic();
4242
for ( i = 0; i < b.iterations; i++ ) {
43-
out = fromString( str );
43+
out = string2buffer( str );
4444
if ( out.length <= 0 ) {
4545
b.fail( 'unexpected length' );
4646
}

lib/node_modules/@stdlib/buffer/from-string/examples/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
var randu = require( '@stdlib/random/base/randu' );
44
var randint = require( '@stdlib/random/base/discrete-uniform' );
5-
var fromString = require( './../lib' );
5+
var string2buffer = require( './../lib' );
66

77
// Create a buffer from a string:
8-
var buf = fromString( 'beep boop bop' );
8+
var buf = string2buffer( 'beep boop bop' );
99
console.log( buf.toString() );
1010

1111
// Generate random strings...

lib/node_modules/@stdlib/buffer/from-string/lib/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
* @module @stdlib/buffer/from-string
77
*
88
* @example
9-
* var fromString = require( '@stdlib/buffer/from-string' );
9+
* var string2buffer = require( '@stdlib/buffer/from-string' );
1010
*
11-
* var buf = fromString( 'beep boop' );
11+
* var buf = string2buffer( 'beep boop' );
1212
* // returns <Buffer>
1313
*/
1414

@@ -19,14 +19,14 @@ var hasFrom = require( './has_from.js' );
1919

2020
// MAIN //
2121

22-
var fromString;
22+
var string2buffer;
2323
if ( hasFrom ) {
24-
fromString = require( './main.js' );
24+
string2buffer = require( './main.js' );
2525
} else {
26-
fromString = require( './polyfill.js' );
26+
string2buffer = require( './polyfill.js' );
2727
}
2828

2929

3030
// EXPORTS //
3131

32-
module.exports = fromString;
32+
module.exports = string2buffer;

lib/node_modules/@stdlib/buffer/from-string/test/test.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,30 @@ var proxyquire = require( 'proxyquire' );
77
var isBuffer = require( '@stdlib/assert/is-buffer' );
88
var polyfill = require( './../lib/polyfill.js' );
99
var nonPolyfill = require( './../lib/main.js' );
10-
var fromString = require( './../lib' );
10+
var string2buffer = require( './../lib' );
1111

1212

1313
// TESTS //
1414

1515
tape( 'main export is a function', function test( t ) {
1616
t.ok( true, __filename );
17-
t.strictEqual( typeof fromString, 'function', 'main export is a function' );
17+
t.strictEqual( typeof string2buffer, 'function', 'main export is a function' );
1818
t.end();
1919
});
2020

2121
tape( 'in older environments, the main export is a polyfill', function test( t ) {
22-
var fromString = proxyquire( './../lib', {
22+
var string2buffer = proxyquire( './../lib', {
2323
'./has_from.js': false
2424
});
25-
t.strictEqual( fromString, polyfill, 'returns polyfill' );
25+
t.strictEqual( string2buffer, polyfill, 'returns polyfill' );
2626
t.end();
2727
});
2828

2929
tape( 'in newer environments, the main export is not a polyfill', function test( t ) {
30-
var fromString = proxyquire( './../lib', {
30+
var string2buffer = proxyquire( './../lib', {
3131
'./has_from.js': true
3232
});
33-
t.strictEqual( fromString, nonPolyfill, 'does not return polyfill' );
33+
t.strictEqual( string2buffer, nonPolyfill, 'does not return polyfill' );
3434
t.end();
3535
});
3636

@@ -58,7 +58,7 @@ tape( 'the function throws an error if not provided a string', function test( t
5858

5959
function badValue( value ) {
6060
return function badValue() {
61-
fromString( value );
61+
string2buffer( value );
6262
};
6363
}
6464
});
@@ -87,7 +87,7 @@ tape( 'the function throws an error if not provided a string (encoding)', functi
8787

8888
function badValue( value ) {
8989
return function badValue() {
90-
fromString( value, 'utf8' );
90+
string2buffer( value, 'utf8' );
9191
};
9292
}
9393
});
@@ -119,21 +119,21 @@ tape( 'the function throws an error if not provided a valid encoding argument',
119119

120120
function badValue( value ) {
121121
return function badValue() {
122-
fromString( 'beep', value );
122+
string2buffer( 'beep', value );
123123
};
124124
}
125125
});
126126

127127
tape( 'the function allocates a buffer containing a provided string', function test( t ) {
128-
var buf = fromString( 'beep boop' );
128+
var buf = string2buffer( 'beep boop' );
129129
t.strictEqual( isBuffer( buf ), true, 'returns a buffer' );
130130
t.strictEqual( buf.length, 9, 'has expected length' );
131131
t.strictEqual( buf.toString(), 'beep boop', 'returns expected value' );
132132
t.end();
133133
});
134134

135135
tape( 'the function allocates a buffer containing a provided string (encoding)', function test( t ) {
136-
var buf = fromString( '7468697320697320612074c3a97374', 'hex' );
136+
var buf = string2buffer( '7468697320697320612074c3a97374', 'hex' );
137137
t.strictEqual( isBuffer( buf ), true, 'returns a buffer' );
138138
t.strictEqual( buf.length, 15, 'has expected length' );
139139
t.strictEqual( buf.toString(), 'this is a tést', 'returns expected value' );

lib/node_modules/@stdlib/buffer/from-string/test/test.main.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var tape = require( 'tape' );
66
var isBuffer = require( '@stdlib/assert/is-buffer' );
77
var isFunction = require( '@stdlib/assert/is-function' );
88
var Buffer = require( '@stdlib/buffer/ctor' );
9-
var fromString = require( './../lib/main.js' );
9+
var string2buffer = require( './../lib/main.js' );
1010

1111

1212
// VARIABLES //
@@ -20,7 +20,7 @@ var opts = {
2020

2121
tape( 'main export is a function', function test( t ) {
2222
t.ok( true, __filename );
23-
t.strictEqual( typeof fromString, 'function', 'main export is a function' );
23+
t.strictEqual( typeof string2buffer, 'function', 'main export is a function' );
2424
t.end();
2525
});
2626

@@ -48,7 +48,7 @@ tape( 'the function throws an error if not provided a string', function test( t
4848

4949
function badValue( value ) {
5050
return function badValue() {
51-
fromString( value );
51+
string2buffer( value );
5252
};
5353
}
5454
});
@@ -77,7 +77,7 @@ tape( 'the function throws an error if not provided a string (encoding)', functi
7777

7878
function badValue( value ) {
7979
return function badValue() {
80-
fromString( value, 'utf8' );
80+
string2buffer( value, 'utf8' );
8181
};
8282
}
8383
});
@@ -109,21 +109,21 @@ tape( 'the function throws an error if not provided a valid encoding argument',
109109

110110
function badValue( value ) {
111111
return function badValue() {
112-
fromString( 'beep', value );
112+
string2buffer( 'beep', value );
113113
};
114114
}
115115
});
116116

117117
tape( 'the function allocates a buffer containing a provided string', opts, function test( t ) {
118-
var buf = fromString( 'beep boop' );
118+
var buf = string2buffer( 'beep boop' );
119119
t.strictEqual( isBuffer( buf ), true, 'returns a buffer' );
120120
t.strictEqual( buf.length, 9, 'has expected length' );
121121
t.strictEqual( buf.toString(), 'beep boop', 'returns expected value' );
122122
t.end();
123123
});
124124

125125
tape( 'the function allocates a buffer containing a provided string (encoding)', opts, function test( t ) {
126-
var buf = fromString( '7468697320697320612074c3a97374', 'hex' );
126+
var buf = string2buffer( '7468697320697320612074c3a97374', 'hex' );
127127
t.strictEqual( isBuffer( buf ), true, 'returns a buffer' );
128128
t.strictEqual( buf.length, 15, 'has expected length' );
129129
t.strictEqual( buf.toString(), 'this is a tést', 'returns expected value' );

lib/node_modules/@stdlib/buffer/from-string/test/test.polyfill.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
var tape = require( 'tape' );
66
var isBuffer = require( '@stdlib/assert/is-buffer' );
7-
var fromString = require( './../lib/polyfill.js' );
7+
var string2buffer = require( './../lib/polyfill.js' );
88

99

1010
// TESTS //
1111

1212
tape( 'main export is a function', function test( t ) {
1313
t.ok( true, __filename );
14-
t.strictEqual( typeof fromString, 'function', 'main export is a function' );
14+
t.strictEqual( typeof string2buffer, 'function', 'main export is a function' );
1515
t.end();
1616
});
1717

@@ -39,7 +39,7 @@ tape( 'the function throws an error if not provided a string', function test( t
3939

4040
function badValue( value ) {
4141
return function badValue() {
42-
fromString( value );
42+
string2buffer( value );
4343
};
4444
}
4545
});
@@ -68,7 +68,7 @@ tape( 'the function throws an error if not provided a string (encoding)', functi
6868

6969
function badValue( value ) {
7070
return function badValue() {
71-
fromString( value, 'utf8' );
71+
string2buffer( value, 'utf8' );
7272
};
7373
}
7474
});
@@ -100,21 +100,21 @@ tape( 'the function throws an error if not provided a valid encoding argument',
100100

101101
function badValue( value ) {
102102
return function badValue() {
103-
fromString( 'beep', value );
103+
string2buffer( 'beep', value );
104104
};
105105
}
106106
});
107107

108108
tape( 'the function allocates a buffer containing a provided string', function test( t ) {
109-
var buf = fromString( 'beep boop' );
109+
var buf = string2buffer( 'beep boop' );
110110
t.strictEqual( isBuffer( buf ), true, 'returns a buffer' );
111111
t.strictEqual( buf.length, 9, 'has expected length' );
112112
t.strictEqual( buf.toString(), 'beep boop', 'returns expected value' );
113113
t.end();
114114
});
115115

116116
tape( 'the function allocates a buffer containing a provided string (encoding)', function test( t ) {
117-
var buf = fromString( '7468697320697320612074c3a97374', 'hex' );
117+
var buf = string2buffer( '7468697320697320612074c3a97374', 'hex' );
118118
t.strictEqual( isBuffer( buf ), true, 'returns a buffer' );
119119
t.strictEqual( buf.length, 15, 'has expected length' );
120120
t.strictEqual( buf.toString(), 'this is a tést', 'returns expected value' );

0 commit comments

Comments
 (0)