## API Reference - Helper Functions

These are helper functions used internally by the core validation functions, but they can also be called independently for specific use cases. For example, a user may call `checkIsLivingAtlasSupportedItemType` to determine if an item is a supported Living Atlas type before invoking validate. Similarly, `isRecognizedLocation` can be used to verify whether a string qualifies as recognized location information before using it as a custom pattern in `matchLocationInfo`.

### `isEligibleForCheckingTitleAndSnippetSearchability`
Determines if an item is eligible for checking title and snippet searchability.

```ts
import { isEligibleForCheckingTitleAndSnippetSearchability } from '@vannizhang/living-atlas-content-validator';

isEligibleForCheckingTitleAndSnippetSearchability(
    item: IItem
): boolean
```

**Parameters:**
- `item` (`IItem`, required): The ArcGIS Online item to check.

**Returns:**
- `boolean`: `true` if the item meets the criteria for checking title and snippet searchability, otherwise `false`.

**Eligibility Criteria:**
1. The item is a layer.
2. The item is English-based.

**Remarks:**
- The locale is determined by both the item's `culture` property and the item's owner.

**Example:**
```ts
import { isEligibleForCheckingTitleAndSnippetSearchability } from '@vannizhang/living-atlas-content-validator';

const item = {
    id: 'mock-item-id',
    owner: 'mock-owner',
    title: 'Mock Item Title',
    culture: 'en',
    type: 'Feature Layer',
    // Other properties...
};

const isEligible = isEligibleForCheckingTitleAndSnippetSearchability(item);
console.log(isEligible); // true or false
```

---

### `matchLocationInfo`
Matches location information from an item's title and snippet using predefined or custom matching patterns.

```ts
import { matchLocationInfo } from '@vannizhang/living-atlas-content-validator';

matchLocationInfo(
    item: IItem,
    customMatchingPatterns?: string[]
): MatchResult[]
```

**Parameters:**
- `item` (`IItem`, required): The ArcGIS Online item containing the title and snippet to search for location information.
- `customMatchingPatterns` (`string[]`, optional): Custom matching patterns to include in the search.

**Returns:**
- `MatchResult[]`: An array of matched results for location information after deduplication and removing overlaps.

**Example:**
```ts
import { matchLocationInfo } from '@vannizhang/living-atlas-content-validator';

const item = {
    title: 'Earthquake Data for California',
    snippet: 'This dataset provides earthquake information for the state of California.',
    // Other properties...
};

const customPatterns = ['California', 'Los Angeles'];

const matchedLocations = matchLocationInfo(item, customPatterns);
console.log(matchedLocations);
```

---

### `isRecognizedLocation`
Determines if a given string is recognized as location information.

```ts
import { isRecognizedLocation } from '@vannizhang/living-atlas-content-validator';

isRecognizedLocation(
    str: string
): boolean
```

**Parameters:**
- `str` (`string`, required): The string to check.

**Returns:**
- `boolean`: `true` if the string is recognized as location information, `false` otherwise.

**Example:**
```ts
import { isRecognizedLocation } from '@vannizhang/living-atlas-content-validator';

const location = 'California';

const isRecognized = isRecognizedLocation(location);
console.log(isRecognized); // true or false
```

---

### `isRejectedLocationInfo`
Determines if a given string is rejected as location information.

```ts
import { isRejectedLocationInfo } from '@vannizhang/living-atlas-content-validator';

isRejectedLocationInfo(
    str: string
): boolean
```

**Parameters:**
- `str` (`string`, required): The string to check.

**Returns:**
- `boolean`: `true` if the string is rejected as location information, `false` otherwise.

**Example:**
```ts
import { isRejectedLocationInfo } from '@vannizhang/living-atlas-content-validator';

const location = 'Unknown Location';

const isRejected = isRejectedLocationInfo(location);
console.log(isRejected); // true or false
```

---

### `matchSourceInfo`
Matches source information from an item's title and snippet using predefined or custom matching patterns.

```ts
import { matchSourceInfo } from '@vannizhang/living-atlas-content-validator';

matchSourceInfo(
    item: IItem,
    customMatchingPatterns?: string[]
): MatchResult[]
```

**Parameters:**
- `item` (`IItem`, required): The ArcGIS Online item containing the title and snippet to search for source information.
- `customMatchingPatterns` (`string[]`, optional): Custom matching patterns to include in the search.

**Returns:**
- `MatchResult[]`: An array of matched results for source information after deduplication and removing overlaps.

**Example:**
```ts
import { matchSourceInfo } from '@vannizhang/living-atlas-content-validator';

const item = {
    title: 'Earthquake Data from NOAA',
    snippet: 'This dataset provides earthquake information sourced from NOAA.',
    // Other properties...
};

const customPatterns = ['NOAA', 'USGS'];

const matchedSources = matchSourceInfo(item, customPatterns);
console.log(matchedSources);
```

---

### `isRecognizedSource`
Determines if a given string is recognized as source information.

```ts
import { isRecognizedSource } from '@vannizhang/living-atlas-content-validator';

isRecognizedSource(
    str: string
): boolean
```

**Parameters:**
- `str` (`string`, required): The string to check.

**Returns:**
- `boolean`: `true` if the string is recognized as source information, `false` otherwise.

**Example:**
```ts
import { isRecognizedSource } from '@vannizhang/living-atlas-content-validator';

const source = 'NOAA';

const isRecognized = isRecognizedSource(source);
console.log(isRecognized); // true or false
```

---

### `isRejectedSourceInfo`
Determines if a given string is rejected as source information.

```ts
import { isRejectedSourceInfo } from '@vannizhang/living-atlas-content-validator';

isRejectedSourceInfo(
    str: string
): boolean
```

**Parameters:**
- `str` (`string`, required): The string to check.

**Returns:**
- `boolean`: `true` if the string is rejected as source information, `false` otherwise.

**Example:**
```ts
import { isRejectedSourceInfo } from '@vannizhang/living-atlas-content-validator';

const source = 'Unknown Source';

const isRejected = isRejectedSourceInfo(source);
console.log(isRejected); // true or false
```

---

### `matchTopicInfo`
Matches topic information from an item's title and snippet using predefined or custom matching patterns.

```ts
import { matchTopicInfo } from '@vannizhang/living-atlas-content-validator';

matchTopicInfo(
    item: IItem,
    customMatchingPatterns?: string[]
): MatchResult[]
```

**Parameters:**
- `item` (`IItem`, required): The ArcGIS Online item containing the title and snippet to search for topic information.
- `customMatchingPatterns` (`string[]`, optional): Custom matching patterns to include in the search.

**Returns:**
- `MatchResult[]`: An array of matched results for topic information after deduplication and removing overlaps.

**Example:**
```ts
import { matchTopicInfo } from '@vannizhang/living-atlas-content-validator';

const item = {
    title: 'Climate Change Impact Analysis',
    snippet: 'This dataset provides insights into the impact of climate change on global ecosystems.',
    // Other properties...
};

const customPatterns = ['Climate Change', 'Global Warming'];

const matchedTopics = matchTopicInfo(item, customPatterns);
console.log(matchedTopics);
```

---

### `isRecognizedTopic`
Determines if a given string is recognized as topic information.

```ts
import { isRecognizedTopic } from '@vannizhang/living-atlas-content-validator';

isRecognizedTopic(
    str: string
): boolean
```

**Parameters:**
- `str` (`string`, required): The string to check.

**Returns:**
- `boolean`: `true` if the string is recognized as topic information, `false` otherwise.

**Example:**
```ts
import { isRecognizedTopic } from '@vannizhang/living-atlas-content-validator';

const topic = 'Climate Change';

const isRecognized = isRecognizedTopic(topic);
console.log(isRecognized); // true or false
```

---

### `isRejectedTopicInfo`
Determines if a given string is rejected as topic information.

```ts
import { isRejectedTopicInfo } from '@vannizhang/living-atlas-content-validator';

isRejectedTopicInfo(
    str: string
): boolean
```

**Parameters:**
- `str` (`string`, required): The string to check.

**Returns:**
- `boolean`: `true` if the string is rejected as topic information, `false` otherwise.

**Example:**
```ts
import { isRejectedTopicInfo } from '@vannizhang/living-atlas-content-validator';

const topic = 'Unknown Topic';

const isRejected = isRejectedTopicInfo(topic);
console.log(isRejected); // true or false
```

---

### `matchDateTimeInfo`
Matches date and time information from an item's title and snippet using predefined or custom matching patterns.

```ts
import { matchDateTimeInfo } from '@vannizhang/living-atlas-content-validator';

matchDateTimeInfo(
    item: IItem,
    customMatchingPatterns?: string[]
): MatchResult[]
```

**Parameters:**
- `item` (`IItem`, required): The ArcGIS Online item containing the title and snippet to search for date and time information.
- `customMatchingPatterns` (`string[]`, optional): Custom matching patterns to include in the search.

**Returns:**
- `MatchResult[]`: An array of matched results for date and time information after deduplication and removing overlaps.

**Example:**
```ts
import { matchDateTimeInfo } from '@vannizhang/living-atlas-content-validator';

const item = {
    title: 'Climate Data for 2020-2025',
    snippet: 'This dataset provides monthly climate data for the years 2020 to 2025.',
    // Other properties...
};

const customPatterns = ['2020', '2025'];

const matchedDateTimeInfo = matchDateTimeInfo(item, customPatterns);
console.log(matchedDateTimeInfo);
```

---

### `isRecognizedDateTimeInfo`
Determines if a given string is recognized as date and time information.

```ts
import { isRecognizedDateTimeInfo } from '@vannizhang/living-atlas-content-validator';

isRecognizedDateTimeInfo(
    str: string
): boolean
```

**Parameters:**
- `str` (`string`, required): The string to check.

**Returns:**
- `boolean`: `true` if the string is recognized as date and time information, `false` otherwise.

**Example:**
```ts
import { isRecognizedDateTimeInfo } from '@vannizhang/living-atlas-content-validator';

const dateTimeInfo = '2020-2025';

const isRecognized = isRecognizedDateTimeInfo(dateTimeInfo);
console.log(isRecognized); // true or false
```

---

### `isRejectedDateTimeInfo`
Determines if a given string is rejected as date and time information.

```ts
import { isRejectedDateTimeInfo } from '@vannizhang/living-atlas-content-validator';

isRejectedDateTimeInfo(
    str: string
): boolean
```

**Parameters:**
- `str` (`string`, required): The string to check.

**Returns:**
- `boolean`: `true` if the string is rejected as date and time information, `false` otherwise.

**Example:**
```ts
import { isRejectedDateTimeInfo } from '@vannizhang/living-atlas-content-validator';

const dateTimeInfo = 'Unknown Year';

const isRejected = isRejectedDateTimeInfo(dateTimeInfo);
console.log(isRejected); // true or false
```

---

### `getLivingAtlasSupportedItemTypes`
This function returns an array containing all the predefined item types that are supported by Living Atlas from the configuration.

```ts
import { getLivingAtlasSupportedItemTypes } from '@vannizhang/living-atlas-content-validator';

getLivingAtlasSupportedItemTypes(): LivingAtlasSupportedItemType[]
```

**Returns:**
- `LivingAtlasSupportedItemType[]`: An array of Living Atlas supported item types.

**Example:**
```ts
import { getLivingAtlasSupportedItemTypes } from '@vannizhang/living-atlas-content-validator';

const supportedItemTypes = getLivingAtlasSupportedItemTypes();
console.log(supportedItemTypes);
```

---

### `checkIsLivingAtlasSupportedItemType`
This function determines whether the provided item type string is included in the predefined list of item types supported by Living Atlas.
```ts
import { checkIsLivingAtlasSupportedItemType } from '@vannizhang/living-atlas-content-validator';

checkIsLivingAtlasSupportedItemType(
    item: IItem
): boolean
```

**Parameters:**
- `item` (`IItem`, required): The ArcGIS Online item to check.

**Returns:**
- `boolean`: `true` if the item type is supported by Living Atlas, otherwise `false`.

**Example:**
```ts
import { checkIsLivingAtlasSupportedItemType } from '@vannizhang/living-atlas-content-validator';

const item = {
    id: 'mock-item-id',
    type: 'Web Map',
    // Other properties...
};

const isSupported = checkIsLivingAtlasSupportedItemType(item);
console.log(isSupported); // true or false
```