# core/predicates/location.predicate.ts

> 10 lines of code and 3 definitions.

Tree: GovLab Paths
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/paths#file-paths-core-predicates-location-predicate-ts
Source text: https://banes-lab.com/source/paths/core/predicates/location.predicate.ts.txt

Listed in [core/predicates](https://banes-lab.com/api/source/paths/core/predicates.md).

## Definitions

- `isRecord` (lexical_declaration, line 3, exported)
- `isPathTree` (lexical_declaration, line 11, exported)
- `isStringLeafTree` (lexical_declaration, line 7)

## Contained in

- [core/predicates](https://banes-lab.com/anatomy/paths/folder-paths-core-predicates.md)

## Used by

- [core/converters/location.converter.ts](https://banes-lab.com/source/paths/core/converters/location.converter.ts.md)
- [core/loaders/location.loader.ts](https://banes-lab.com/source/paths/core/loaders/location.loader.ts.md)
- [core/resolvers/location.resolver.ts](https://banes-lab.com/source/paths/core/resolvers/location.resolver.ts.md)
- [core/resolvers/location.root.resolver.ts](https://banes-lab.com/source/paths/core/resolvers/location.root.resolver.ts.md)

## Linked from

- [core/converters](https://banes-lab.com/anatomy/paths/folder-paths-core-converters.md)
- [core/loaders](https://banes-lab.com/anatomy/paths/folder-paths-core-loaders.md)
- [core/predicates](https://banes-lab.com/anatomy/paths/folder-paths-core-predicates.md)
- [core/resolvers](https://banes-lab.com/anatomy/paths/folder-paths-core-resolvers.md)

## Source

```typescript
import type { PathTree } from "#types/location.types";

export const isRecord = function isRecord(value: unknown): value is Record<string, unknown> {
    return typeof value === "object" && value !== null;
};

const isStringLeafTree = function isStringLeafTree(value: unknown): boolean {
    return typeof value === "string" || (isRecord(value) && Object.values(value).every(isStringLeafTree));
};

export const isPathTree = function isPathTree(value: unknown): value is PathTree {
    return isRecord(value) && Object.values(value).every(isStringLeafTree);
};
```
