# credit-roles

> Enumeration and normalization of CRT Contributor Roles (https://credit.niso.org/)

Latest version **2.1.0** (published 2023-08-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install credit-roles
pnpm add credit-roles
yarn add credit-roles
bun add credit-roles
```

## Health

**Score 40/100 (D)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2023-08-09 |
| First published | 2023-01-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 12.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Rowan Cockett |
| Maintainers | rowanc1, stevejpurves |
| Keywords | CREDIT, Open Science |

## Links

- npm: https://www.npmjs.com/package/credit-roles
- Repository: https://github.com/curvenote/credit-roles
- Issues: https://github.com/curvenote/credit-roles/issues
- npm.io page: https://npm.io/package/credit-roles

## Recent versions

- 2.1.0 (latest) — 2023-08-09
- 2.0.0 — 2023-06-09
- 1.0.0 — 2023-01-01

## README

# credit-roles

[![credit-roles on npm](https://img.shields.io/npm/v/credit-roles.svg)](https://www.npmjs.com/package/credit-roles)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/curvenote/credit-roles/blob/main/LICENSE)
![CI](https://github.com/curvenote/credit-roles/workflows/CI/badge.svg)

> CRediT (Contributor Roles Taxonomy) is a high-level taxonomy, including 14 roles, that can be used to represent the roles typically played by contributors to research outputs. The roles describe each contributor’s specific contribution to the scholarly output. (https://credit.niso.org/)

A utility for validating [CRT Contributor Roles](https://credit.niso.org/) in your application, building canonical URLs, and showing descriptions.

```shell
npm install credit-roles
```

The library has **no dependencies**, and is helpful in validating, normalizing and showing descriptions of CRediT roles.

## Overview & Usage

```ts
import { credit, CreditRole, CreditDescriptions } from 'credit-roles';

// Validate that a string is a role
credit.validate('contributor'); // true

// Handles British spelling and capitalizations
credit.normalize('conceptualiSation'); // "Conceptualization"

// Handles different punctuation
credit.normalize('writing:  original draft'); // "Writing – original draft"

// Show the descriptions in your application
CreditDescriptions['Supervision']; // Oversight and leadership responsibility...

// An enum for easy access to the roles
CreditRole.WritingOriginalDraft;
```

## Included Utilities

- `validate` - Validates if a string to a CRediT role if it is valid, will take URLs and unformatted strings
- `normalize` - Normalizes a CRediT string into the canonical string (including hyphens, capitalization and punctuation)
- `buildUrl` - Builds a URL to https://credit.niso.org, includes normalization
- `CreditRole` - an enum of the CRediT roles
- `CreditDescriptions` - Official descriptions of the CRediT roles by NISO

## Options

- `strict`: only accept normalized CRediT roles when validating or building URLs

## Alias

In addition to british english, incorrect case or punctuation, there are also a number of aliases that can be used for various roles:

| Alias          | Official CRediT Role       |
| -------------- | -------------------------- |
| writing        | Writing – original draft   |
| editing        | Writing – review & editing |
| review         | Writing – review & editing |
| analysis       | Formal analysis            |
| funding        | Funding acquisition        |
| admin          | Project administration     |
| administration | Project administration     |

## References

- https://credit.niso.org/
- https://jats4r.org/credit-taxonomy

---

As of v2.0.0 this package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).

---

<p style="text-align: center; color: #aaa; padding-top: 50px">
  Made with love by
  <a href="https://curvenote.com" target="_blank" style="color: #aaa">
    <img src="https://curvenote.dev/images/icon.png" style="height: 1em" /> Curvenote
  </a>
</p>

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