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+
18<a name =" 1.0.1 " ></a >
29# [ 1.0.1] ( https://github.com/faker-javascript/string ) (2022-01-08)
310* Package fixes
Original file line number Diff line number Diff line change @@ -15,15 +15,15 @@ $ npm install --save @fakerjs/string
1515## Usage
1616
1717``` js
18- import fakeString from ' @fakerjs/string' ;
18+ import string from ' @fakerjs/string' ;
1919
20- fakeString ();
20+ string ();
2121// => 3Kekravwvb78vP9CQPP1vaRCgi4dZETOktxzf8pF5gufFqh8mOICMqjRP4y8UxoI
2222
23- fakeString (10 );
23+ string (10 );
2424// => FxvqHNFNUu
2525
26- fakeString (10 , ' #@$%&+=' );
26+ string (10 , ' #@$%&+=' );
2727// => $+#%#&$$=@
2828```
2929
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' ;
25 let pieces = [ ] ;
36 if ( length < 0 ) {
47 length = 1 ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @fakerjs/string" ,
3- "version" : " 1 .0.1 " ,
3+ "version" : " 2 .0.0 " ,
44 "description" : " String package provides functionality to generate a fake string value." ,
55 "license" : " MIT" ,
66 "repository" : " faker-javascript/string" ,
2525 ],
2626 "keywords" : [
2727 " fakerjs" ,
28+ " faker" ,
2829 " fake" ,
2930 " random" ,
3031 " strings" ,
Original file line number Diff line number Diff line change 1- import fakeString from './index.js' ;
1+ import string from './index.js' ;
22import test from 'ava' ;
33
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' ) ;
67} ) ;
78
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 ) ;
1011} ) ;
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