File tree Expand file tree Collapse file tree 5 files changed +27
-11
lines changed Expand file tree Collapse file tree 5 files changed +27
-11
lines changed Original file line number Diff line number Diff line change
1
+ <a name =" 2.0.0 " ></a >
2
+ # [ 2.0.0] ( https://github.com/faker-javascript/string ) (2022-01-09)
3
+
4
+ ### BREAKING CHANGES
5
+
6
+ * New function ` string ` istead of ` fakeString `
7
+
1
8
<a name =" 1.0.1 " ></a >
2
9
# [ 1.0.1] ( https://github.com/faker-javascript/string ) (2022-01-08)
3
10
* Package fixes
Original file line number Diff line number Diff line change @@ -15,15 +15,15 @@ $ npm install --save @fakerjs/string
15
15
## Usage
16
16
17
17
``` js
18
- import fakeString from ' @fakerjs/string' ;
18
+ import string from ' @fakerjs/string' ;
19
19
20
- fakeString ();
20
+ string ();
21
21
// => 3Kekravwvb78vP9CQPP1vaRCgi4dZETOktxzf8pF5gufFqh8mOICMqjRP4y8UxoI
22
22
23
- fakeString (10 );
23
+ string (10 );
24
24
// => FxvqHNFNUu
25
25
26
- fakeString (10 , ' #@$%&+=' );
26
+ string (10 , ' #@$%&+=' );
27
27
// => $+#%#&$$=@
28
28
```
29
29
Original file line number Diff line number Diff line change 1
- export default function fakeString ( length = 64 , keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ) {
1
+ export default function string ( options ) {
2
+ options = options || { } ;
3
+ let length = options . length || 64 ;
4
+ let keyspace = options . keyspace || '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ;
2
5
let pieces = [ ] ;
3
6
if ( length < 0 ) {
4
7
length = 1 ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @fakerjs/string" ,
3
- "version" : " 1 .0.1 " ,
3
+ "version" : " 2 .0.0 " ,
4
4
"description" : " String package provides functionality to generate a fake string value." ,
5
5
"license" : " MIT" ,
6
6
"repository" : " faker-javascript/string" ,
25
25
],
26
26
"keywords" : [
27
27
" fakerjs" ,
28
+ " faker" ,
28
29
" fake" ,
29
30
" random" ,
30
31
" strings" ,
Original file line number Diff line number Diff line change 1
- import fakeString from './index.js' ;
1
+ import string from './index.js' ;
2
2
import test from 'ava' ;
3
3
4
- test ( 'fakeString return type to be string' , t => {
5
- t . is ( typeof fakeString ( ) , 'string' ) ;
4
+ //console.log(string({length: 10}));
5
+ test ( 'string return type to be string' , t => {
6
+ t . is ( typeof string ( ) , 'string' ) ;
6
7
} ) ;
7
8
8
- test ( 'fakeString string length is 10' , t => {
9
- t . is ( fakeString ( 10 ) . length , 10 ) ;
9
+ test ( 'string length is 10' , t => {
10
+ t . is ( string ( { length : 10 } ) . length , 10 ) ;
10
11
} ) ;
12
+
13
+ test ( 'string length is 10 with keyspace 0123456789' , t => {
14
+ t . is ( string ( { length : 10 , keyspace : '0123456789' } ) . length , 10 ) ;
15
+ } ) ;
You can’t perform that action at this time.
0 commit comments