credit-roles
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -45,2 +45,11 @@ export const CREDIT_URL = 'https://credit.niso.org/'; | ||
export const ROLES = Object.keys(CreditDescriptions); // enums are not easy to index | ||
const ALIAS_ROLES = { | ||
writing: CreditRole.WritingOriginalDraft, | ||
editing: CreditRole.WritingReviewEditing, | ||
review: CreditRole.WritingReviewEditing, | ||
analysis: CreditRole.FormalAnalysis, | ||
funding: CreditRole.FundingAcquisition, | ||
admin: CreditRole.ProjectAdministration, | ||
administration: CreditRole.ProjectAdministration, | ||
}; | ||
/** | ||
@@ -67,3 +76,3 @@ * Standardize various strings to a common string with british spelling, not for external use. | ||
export function normalize(value, opts) { | ||
var _a; | ||
var _a, _b; | ||
if (!value) | ||
@@ -75,3 +84,3 @@ return undefined; | ||
return undefined; | ||
return (_a = STANDARDIZED_ROLES[standardize(value)]) !== null && _a !== void 0 ? _a : undefined; | ||
return ((_b = (_a = STANDARDIZED_ROLES[standardize(value)]) !== null && _a !== void 0 ? _a : ALIAS_ROLES[value.toLowerCase().trim()]) !== null && _b !== void 0 ? _b : undefined); | ||
} | ||
@@ -78,0 +87,0 @@ /** |
{ | ||
"name": "credit-roles", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Enumeration and normalization of CRT Contributor Roles (https://credit.niso.org/)", | ||
@@ -43,9 +43,9 @@ "keywords": [ | ||
"devDependencies": { | ||
"eslint": "^8.42.0", | ||
"eslint": "^8.46.0", | ||
"eslint-config-curvenote": "latest", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.8.8", | ||
"typescript": "^5.1.3", | ||
"vitest": "^0.32.0" | ||
"prettier": "^3.0.1", | ||
"typescript": "^5.1.6", | ||
"vitest": "^0.34.1" | ||
} | ||
} |
@@ -20,3 +20,3 @@ # credit-roles | ||
```ts | ||
import credit, { CreditRole, CreditDescriptions } from 'credit-roles'; | ||
import { credit, CreditRole, CreditDescriptions } from 'credit-roles'; | ||
@@ -51,2 +51,16 @@ // Validate that a string is a role | ||
## 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 | ||
@@ -53,0 +67,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
13114
163
81
0