Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
feat: more utils
Browse files Browse the repository at this point in the history
  • Loading branch information
rimsila committed Nov 14, 2022
1 parent 8ada123 commit 1c349f4
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 21 deletions.
2 changes: 1 addition & 1 deletion packages/utils/src/_getOnlyValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { _pickBy } from './_pickBy';
remove null ,undefined empty string
* @param values
*/
export function getOnlyValue<T>(values: T): T {
export default function _getOnlyValue<T>(values: T): T {
return _pickBy(
values || {},
(v) => v !== null && v !== undefined && v !== ' ' && v !== 'null',
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/utils/src/_isMergableObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { _isObject } from './_isObject';
* @param item
* @see https://github.com/antfu/utils/blob/7570fb0dddf22d54504370c552c4b3a52389cfe6/src/object.ts#L105
*/
export default function isMergableObject(item: any): item is Object {
export default function _isMergableObject(item: any): item is Object {
return _isObject(item) && !Array.isArray(item);
}
2 changes: 1 addition & 1 deletion packages/utils/src/_listToFlat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { TKeyValue } from './_types';
* @returns TKeyValue
* @summary It is recommended to use with the memoize method to avoid unnecessary conversion and improve performance
*/
export function listToFlat<T extends []>(
export default function _listToFlat<T extends []>(
items: T[],
key: string | number = 'value',
text: string = 'label',
Expand Down
48 changes: 48 additions & 0 deletions packages/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,54 @@ export { default as _isMobile } from './_isMobile';
export { default as _objGetOnlyValue } from './_objGetOnlyValue';
export { default as _objToUndef } from './_objToUndef';
export { _omit } from './_omit';
export { default as _asyncSleep } from './_asyncSleep';
export { _axios } from './_axios';
export * from './_capitalize';
export { default as _dateConstant } from './_constantDate';
export { default as _constantLayout } from './_constantLayout';
export { default as _constantsValidateAntENG } from './_constantsValidateAntENG';
export { default as copyToClipboard } from './_copyToClipboard';
export { default as _dataArrayToOption } from './_dataArrayToOption';
export { _dateUtils } from './_date';
export { default as _debugDeprecated } from './_debugDeprecated';
export { default as _debugLogger } from './_debugLogger';
export { default as _debugWarning } from './_debugWarning';
export * from './_devLorem';
export { default as _files } from './_files';
export { default as _formatTimeMs } from './_formatTimeMs';
export { default as getKeyNameByValue } from './_getKeyNameByValue';
export { default as _getOnlyValue } from './_getOnlyValue';
export * from './_isArray';
export * from './_isBoolean';
export * from './_isClient';
export * from './_isEmpty';
export * from './_isEqual';
export * from './_isExternalLink';
export * from './_isFunction';
export * from './_isImg';
export * from './_isInteger';
export { default as _isKeyOf } from './_isKeyOf';
export { default as _isMergableObject } from './_isMergableObject';
export * from './_isNaN';
export * from './_isNull';
export * from './_isNumber';
export * from './_isObject';
export * from './_isPromise';
export * from './_isRegExp';
export * from './_isUndefined';
export { default as _listToFlat } from './_listToFlat';
export { default as _urlToList } from './_urlToList';
export { default as _keyCode } from './_keyCode';
export { default as _nanoid } from './_nanoid';
export { _noop } from './_noop';
export { _pickBy } from './_pickBy';
export { default as _placeholder } from './_placeholder';
export { default as _removeEmpty } from './_removeEmpty';
export { default as _removeNil } from './_removeNil';
export { default as _renameObjKeys } from './_renameObjKeys';

export * from './_browser';
export * from './_authority';

// _lodash
export * from './_isEmpty';
Expand Down
46 changes: 28 additions & 18 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1c349f4

Please sign in to comment.