mirror of
https://github.com/toss/es-toolkit.git
synced 2024-12-01 10:45:08 +03:00
bf33cfbca5
* Add internal functions * add orderBy with compat * Add docs * Fix typo * Split the code for readability * Change convert to path logic and variable name for readability * Add test cases and js doc in isKey and isSymbol * Add testcase and change logic of isKey * change bench category name * split converToPropertyName for testing * Add case for coverage * fix type * Change using getTage to instanceof * move to predicate * Add doc * Add bench and description in isSymbol * Fix type and test case * Simplify function names * Feat: handle the deep path like keys
34 lines
986 B
TypeScript
34 lines
986 B
TypeScript
import { bench, describe } from 'vitest';
|
|
import { isSymbol as isSymbolToolkit } from 'es-toolkit';
|
|
import { isSymbol as isSymbolToolkitCompat } from 'es-toolkit/compat';
|
|
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);
|
|
});
|
|
|
|
bench('es-toolkit/compat/isSymbol', () => {
|
|
isSymbolToolkitCompat(Symbol('a'));
|
|
isSymbolToolkitCompat(Symbol.for('a'));
|
|
isSymbolToolkitCompat(Symbol.iterator);
|
|
isSymbolToolkitCompat('');
|
|
isSymbolToolkitCompat({});
|
|
isSymbolToolkitCompat(123);
|
|
});
|
|
|
|
bench('lodash/isSymbol', () => {
|
|
isSymbolLodash(Symbol('a'));
|
|
isSymbolLodash(Symbol.for('a'));
|
|
isSymbolLodash(Symbol.iterator);
|
|
isSymbolLodash('');
|
|
isSymbolLodash({});
|
|
isSymbolLodash(123);
|
|
});
|
|
});
|