Component evidence

NocoBase Common Utilities (src/common.ts)

nocobase · packages/core/utils/src/common.ts · typescript · Apache-2.0
dev-toolslang:typescripttag:utilitiestag:data-processingtag:helpers

A collection of general-purpose helper functions for data validation, tree manipulation, and object inspection. Use for standardizing data handling across the application.

Source preview first 800 characters · full source over MCP
// Source: https://github.com/nocobase/nocobase | License: Apache-2.0
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * This file is part of the NocoBase (R) project.
 * Copyright (c) 2020-2024 NocoBase Co., Ltd.
 * Authors: NocoBase Team.
 *
 * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
 * For more information, please refer to: https://www.nocobase.com/agreement.
 */

import _ from 'lodash';
import flat from 'flat';

export const isString = (value: any): value is string => {
  return typeof value === 'string';
};

export const isArray = (value: any): value is Array<any> => {
  return Array.isArray(value);
};

export const isEmpty = (value: unknown) => {
  if (isPlainObject(value)) {
    return Object.keys(value).length === 0;
  }
  

... (truncated -- full source via MCP)