The most translated copyright-free document on this planet: the universal declaration of human rights in unicode in JavaScript.
- What is this?
- When should I use this?
- Install
- Use
- API
- Data
- Compatibility
- Contribute
- Security
- License
This package exposes all UDHRs.
Perhaps when you are dealing with natural language detection?
This package is ESM only. In Node.js (version 18+), install with npm:
npm install udhr
In Deno with esm.sh
:
import {udhr} from 'https://esm.sh/udhr@6'
In browsers with esm.sh
:
<script type="module">
import {udhr} from 'https://esm.sh/udhr@6?bundle'
</script>
import fs from 'node:fs/promises'
import {resolve} from 'import-meta-resolve'
import {udhr} from 'udhr'
for (const d of udhr) {
if (d.code === 'bod') {
console.log(d)
break
}
}
const base = await resolve('udhr', import.meta.url)
// Declarations are stored as `declaration/$code.html`.
const url = new URL('declaration/bod.html', base)
console.log(await fs.readFile(url, 'utf8'))
Yields:
{
code: 'bod',
name: 'Tibetan, Central',
bcp47: 'bo',
ohchr: 'tic',
iso6393: 'bod',
direction: 'ltr',
stage: 4,
latitude: 28.37,
longitude: 90.19
}
<!doctype html>
<html lang="bo" dir="ltr" data-code="bod" data-iso6393="bod">
<head>
<title>Tibetan, Central</title>
</head>
<body>
<h1>༄༅༎ ཡོངས་ཁྱབ་གསལ་བསྒྲགས་འགྲོ་བ་མིའི་ཐོབ་ཐང༌།</h1>
<header>
<h2>སྔོན་བརྗོད།</h2>
<p>༈ འགྲོ་བ་མིའི་ཁྱིམ་ཚང་ཁག་གི་ནང་མི་ཡོངས་ལ་རང་བཞིན་ཉིད་ནས་ཡོད་པའི་ཆེ་མཐོངས་དང་འདྲ་མཉམ། སུས་ཀྱང་འཕྲོག་ཏུ་མི་རུང་བའི་ཐོབ་ཐང་བཅས་ཀྱི་གནད་དོན་རྟོགས པར་བྱེད་པ་ནི། འཛམ་གླིང་ནང་གི་རང་དབང་དང༌། དྲང་བདེན། ཞི་བདེ་བཅས་ཀྱི་རྣང་གཞི་ལྟེ་བ་ཡིན།</p>
…
This package exports the identifier udhr
.
It exports the TypeScript type Info
.
There is no default export.
Universal Declaration of Human Rights (Array<Info>
).
The actual declarations are available in HTML at declaration/$code.html
.
Info (TypeScript type).
interface Info {
bcp47: string
code: string
direction?: 'ltr' | 'rtl' | 'ttb'
iso6393: string
latitude: number
longitude: number
name: string
ohchr?: string
stage: 1 | 2 | 3 | 4 | 5
}
This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 18+. It also works in Deno and modern browsers.
Yes please! See How to Contribute to Open Source.
This package is safe.