@@ -6,7 +6,7 @@ import Chance from 'chance'
66import { Bench } from 'tinybench'
77// @ts -expect-error ts-mocker is typed
88// eslint-disable-next-line antfu/no-import-dist
9- import { faker as ts - mocker } from '../../core/dist/src/index.js'
9+ import { faker } from '../../core/dist/src/index.js'
1010
1111const chance = new Chance ( )
1212
@@ -43,9 +43,9 @@ function printResults(bench: Bench, title: string) {
4343 if ( ! result )
4444 return
4545
46- const ists - mocker = task . name . includes ( 'ts-mocker' )
46+ const isTsMocker = task . name . includes ( 'ts-mocker' )
4747 const isFastest = task === fastest
48- const color = isFastest ? colors . green : ists - mocker ? colors . yellow : colors . reset
48+ const color = isFastest ? colors . green : isTsMocker ? colors . yellow : colors . reset
4949
5050 const opsPerSec = formatOpsPerSec ( result . hz )
5151 const avgTime = `${ ( result . mean * 1000 ) . toFixed ( 4 ) } ms`
@@ -73,7 +73,7 @@ async function runBenchmarks() {
7373 const nameBench = new Bench ( { time : 750 } )
7474 nameBench
7575 . add ( 'ts-mocker' , ( ) => {
76- ts - mocker . person . fullName ( )
76+ faker . person . fullName ( )
7777 } )
7878 . add ( '@faker-js/faker' , ( ) => {
7979 fakerjs . person . fullName ( )
@@ -95,7 +95,7 @@ async function runBenchmarks() {
9595 const emailBench = new Bench ( { time : 750 } )
9696 emailBench
9797 . add ( 'ts-mocker' , ( ) => {
98- ts - mocker . internet . email ( )
98+ faker . internet . email ( )
9999 } )
100100 . add ( '@faker-js/faker' , ( ) => {
101101 fakerjs . internet . email ( )
@@ -117,7 +117,7 @@ async function runBenchmarks() {
117117 const phoneBench = new Bench ( { time : 750 } )
118118 phoneBench
119119 . add ( 'ts-mocker' , ( ) => {
120- ts - mocker . phone . number ( )
120+ faker . phone . number ( )
121121 } )
122122 . add ( '@faker-js/faker' , ( ) => {
123123 fakerjs . phone . number ( )
@@ -139,7 +139,7 @@ async function runBenchmarks() {
139139 const cityBench = new Bench ( { time : 750 } )
140140 cityBench
141141 . add ( 'ts-mocker' , ( ) => {
142- ts - mocker . address . city ( )
142+ faker . address . city ( )
143143 } )
144144 . add ( '@faker-js/faker' , ( ) => {
145145 fakerjs . location . city ( )
@@ -161,7 +161,7 @@ async function runBenchmarks() {
161161 const countryBench = new Bench ( { time : 750 } )
162162 countryBench
163163 . add ( 'ts-mocker' , ( ) => {
164- ts - mocker . address . country ( )
164+ faker . address . country ( )
165165 } )
166166 . add ( '@faker-js/faker' , ( ) => {
167167 fakerjs . location . country ( )
@@ -183,7 +183,7 @@ async function runBenchmarks() {
183183 const companyBench = new Bench ( { time : 750 } )
184184 companyBench
185185 . add ( 'ts-mocker' , ( ) => {
186- ts - mocker . company . name ( )
186+ faker . company . name ( )
187187 } )
188188 . add ( '@faker-js/faker' , ( ) => {
189189 fakerjs . company . name ( )
@@ -205,7 +205,7 @@ async function runBenchmarks() {
205205 const productBench = new Bench ( { time : 750 } )
206206 productBench
207207 . add ( 'ts-mocker' , ( ) => {
208- ts - mocker . commerce . product ( )
208+ faker . commerce . product ( )
209209 } )
210210 . add ( '@faker-js/faker' , ( ) => {
211211 fakerjs . commerce . product ( )
@@ -224,7 +224,7 @@ async function runBenchmarks() {
224224 const uuidBench = new Bench ( { time : 750 } )
225225 uuidBench
226226 . add ( 'ts-mocker' , ( ) => {
227- ts - mocker . string . uuid ( )
227+ faker . string . uuid ( )
228228 } )
229229 . add ( '@faker-js/faker' , ( ) => {
230230 fakerjs . string . uuid ( )
@@ -252,11 +252,11 @@ async function runBenchmarks() {
252252 const nanoStart = performance . now ( )
253253 for ( let i = 0 ; i < iterations ; i ++ ) {
254254 const _user = {
255- name : ts - mocker . person . fullName ( ) ,
256- email : ts - mocker . internet . email ( ) ,
257- phone : ts - mocker . phone . number ( ) ,
258- city : ts - mocker . address . city ( ) ,
259- country : ts - mocker . address . country ( ) ,
255+ name : faker . person . fullName ( ) ,
256+ email : faker . internet . email ( ) ,
257+ phone : faker . phone . number ( ) ,
258+ city : faker . address . city ( ) ,
259+ country : faker . address . country ( ) ,
260260 }
261261 }
262262 const nanoDuration = performance . now ( ) - nanoStart
@@ -322,9 +322,9 @@ async function runBenchmarks() {
322322 ] . sort ( ( a , b ) => a . duration - b . duration )
323323
324324 results . forEach ( ( result , index ) => {
325- const ists - mocker = result . name === 'ts-mocker'
325+ const isTsMocker = result . name === 'ts-mocker'
326326 const isFastest = index === 0
327- const color = isFastest ? colors . green : ists - mocker ? colors . yellow : colors . reset
327+ const color = isFastest ? colors . green : isTsMocker ? colors . yellow : colors . reset
328328
329329 const speedup = results [ 0 ] . duration / result . duration
330330 const speedupText = isFastest ? '(fastest)' : `(${ speedup . toFixed ( 2 ) } x)`
0 commit comments