0.0.9 • Published 2 years ago

usefakedata v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

useFakeData

It allows you to generate random data for the types you specify, just like reading data from an API 🤘.

const employeeList = useFakeData({
    fieldTypes: [
        {
            fieldName: 'id',
            dataType: dataTypes.id,
        },
        {
            fieldName: 'uuid',
            dataType: dataTypes.uuid,
        },
        {
            fieldName: 'firstName',
            dataType: dataTypes.firstName,
        },
        {
            fieldName: 'lastName',
            dataType: dataTypes.lastName,
        },
        {
            fieldName: 'birthDate',
            dataType: dataTypes.date,
            dataMinYear: 1980,
            dataMaxYear: 2000
        },
        {
            fieldName: 'ccardInfo',
            dataType: dataTypes.object,
            children: [
                {
                    fieldName: 'no',
                    dataType: dataTypes.ccardNo,
                }
            ]
        }
    ],
    dataLimit: 5
});

/*
Output:
[
   {
      "id":1,
      "uuid":"50dd5362-a347-4c0d-8e0a-3e7fb787f79b",
      "firstName":"Nairn",
      "lastName":"KING",
      "birthDate":"Thu Jun 23 1983 03:51:36 GMT+0300 (GMT+03:00)",
      "ccardInfo":{
         "no":"6565 4343 4343 34344"
      }
   },
   {
      "id":2,
      "uuid":"409aa470-410f-4b29-b116-93c85a32e1ed",
      "firstName":"T-Jay",
      "lastName":"GARDNER",
      "birthDate":"Tue Jan 31 1984 09:01:11 GMT+0300 (GMT+03:00)",
      "ccardInfo":{
         "no":"4853 4343 4343 34344"
      }
   },
   {
      "id":3,
      "uuid":"7443703b-a2ed-4f49-869c-b4b8f10c4f0f",
      "firstName":"Manson",
      "lastName":"PARKER",
      "birthDate":"Thu Feb 23 1995 11:21:12 GMT+0200 (GMT+03:00)",
      "ccardInfo":{
         "no":"4853 4343 4343 34344"
      }
   },
   {
      "id":4,
      "uuid":"6f7cff69-88a8-49c9-8826-82094f44dff0",
      "firstName":"Nate",
      "lastName":"ARMSTRONG",
      "birthDate":"Sat Dec 02 1995 04:55:15 GMT+0200 (GMT+03:00)",
      "ccardInfo":{
         "no":"6565 4343 4343 34344"
      }
   },
   {
      "id":5,
      "uuid":"fcc9bc0d-0bf8-425b-9171-7d66a4246aa6",
      "firstName":"Isa",
      "lastName":"WYNN",
      "birthDate":"Fri Oct 12 1984 12:00:03 GMT+0300 (GMT+03:00)",
      "ccardInfo":{
         "no":"4853 4343 4343 34344"
      }
   }
]
*/

#Field Types

Field TypeDescription
id
uuid
firstName
lastName
0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago