2024-08-10 04:16:18 +03:00
|
|
|
import { bench, describe } from 'vitest';
|
|
|
|
import { isSymbol as isSymbolToolkit } from 'es-toolkit';
|
2024-08-10 10:30:32 +03:00
|
|
|
import { isSymbol as isSymbolToolkitCompat } from 'es-toolkit/compat';
|
2024-08-10 04:16:18 +03:00
|
|
|
import { isSymbol as isSymbolLodash } from 'lodash';
|
|
|
|
|
|
|
|
describe('isSymbol', () => {
|
|
|
|
bench('es-toolkit/isSymbol', () => {
|
|
|
|
isSymbolToolkit(Symbol('a'));
|
|
|
|
isSymbolToolkit(Symbol.for('a'));
|
|
|
|
isSymbolToolkit(Symbol.iterator);
|
|
|
|
isSymbolToolkit('');
|
|
|
|
isSymbolToolkit({});
|
|
|
|
isSymbolToolkit(123);
|
|
|
|
});
|
2024-08-10 10:30:32 +03:00
|
|
|
|
|
|
|
bench('es-toolkit/compat/isSymbol', () => {
|
|
|
|
isSymbolToolkitCompat(Symbol('a'));
|
|
|
|
isSymbolToolkitCompat(Symbol.for('a'));
|
|
|
|
isSymbolToolkitCompat(Symbol.iterator);
|
|
|
|
isSymbolToolkitCompat('');
|
|
|
|
isSymbolToolkitCompat({});
|
|
|
|
isSymbolToolkitCompat(123);
|
|
|
|
});
|
|
|
|
|
2024-08-10 04:16:18 +03:00
|
|
|
bench('lodash/isSymbol', () => {
|
|
|
|
isSymbolLodash(Symbol('a'));
|
|
|
|
isSymbolLodash(Symbol.for('a'));
|
|
|
|
isSymbolLodash(Symbol.iterator);
|
|
|
|
isSymbolLodash('');
|
|
|
|
isSymbolLodash({});
|
|
|
|
isSymbolLodash(123);
|
|
|
|
});
|
|
|
|
});
|