# @jeswr/prefixcc

> A utility library to lookup prefixes and uris on prefixcc

Latest version **1.2.1** (published 2022-12-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jeswr/prefixcc
pnpm add @jeswr/prefixcc
yarn add @jeswr/prefixcc
bun add @jeswr/prefixcc
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2022-12-14 |
| First published | 2022-12-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 18.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jesse Wright |
| Maintainers | jeswr |
| Keywords | prefix, prefix.cc, RDF, prefixes, URI, Solid |

## Links

- npm: https://www.npmjs.com/package/@jeswr/prefixcc
- Repository: https://github.com/jeswr/prefixcc.js
- Homepage: https://github.com/jeswr/prefixcc.js#readme
- Issues: https://github.com/jeswr/prefixcc.js/issues
- npm.io page: https://npm.io/package/@jeswr/prefixcc

## Dependencies (2)

- [fsevents](https://npm.io/package/fsevents.md) ^2.3.2
- [cross-fetch](https://npm.io/package/cross-fetch.md) ^3.1.5

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.2.1 (latest) — 2022-12-14
- 1.2.0 — 2022-12-14
- 1.1.0 — 2022-12-13

## README

#  prefixcc

Get prefixes for your URIs using the [prefix.cc](http://prefix.cc/) Web API.

[![GitHub license](https://img.shields.io/github/license/jeswr/prefixcc.js.svg)](https://github.com/jeswr/prefixcc.js/blob/master/LICENSE)
[![npm version](https://img.shields.io/npm/v/@jeswr/prefixcc.svg)](https://www.npmjs.com/package/@jeswr/prefixcc)
[![build](https://img.shields.io/github/workflow/status/jeswr/prefixcc.js/Node.js%20CI)](https://github.com/jeswr/prefixcc.js/tree/main/)
[![Dependabot](https://badgen.net/badge/Dependabot/enabled/green?icon=dependabot)](https://dependabot.com/)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

## Usage

Primarily this library can be used to look up common prefixes for a given URI, and also look up the URI most commonly associated with a prefix.

```ts
import { uriToPrefix, prefixToUri, lookupAllPrefixes } from '@jeswr/prefixcc'

const prefix = await uriToPrefix('http://xmlns.com/foaf/0.1/'); // foaf
const url = await prefixToUri('foaf');                          // http://xmlns.com/foaf/0.1/

// Returns an object with all prefixes recorded in prefix.cc
const prefixes = await lookupAllPrefixes(); // { ..., foaf: 'http://xmlns.com/foaf/0.1/', ... }
```

It can also mint new prefixes when there are no recommended ones available

```ts
await uriToPrefix('https://www.my-url/etad/', { mintOnUnknown: true }); // etad
```

and ensure that prefixes are unique from those that you're already using

```ts
await uriToPrefix(
  'https://www.my-url-2/etad/', {
    mintOnUnknown: true,
    existingPrefixes: { etad: 'https://www.my-url/etad/' }
}); // etad0

await uriToPrefix(
  'http://xmlns.com/foaf/0.1/', {
    existingPrefixes: { foaf: 'https://www.my-url/' }
}); // foaf0
```

## License
©2022–present
[Jesse Wright](https://github.com/jeswr),
[MIT License](https://github.com/jeswr/useState/blob/master/LICENSE).

---
_Source: https://npm.io/package/@jeswr/prefixcc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
