@entva/openterms
TypeScript icon, indicating that this package has built-in type declarations

1.8.0 • Public • Published

OpenTerms

Generate legal texts in markdown format. Lightweight, 0 dependencies. A good starter template to feed to ChatGPT or to use programmatically directly.

DISCLAIMER: OpenTerms is not a replacement for a lawyer and can't be held responsible for any damages you incur while using it's content. This software is provided "as is" under the MIT License with neither liability nor warranty.

Usage:

import { appPrivacy, appTerms, webPrivacy, webTerms } from '@entva/openterms';

const options = {
  company: 'Example, Inc.',
  email: 'contact@example.com',
  website: 'https://example.com',
  address: '123 Example Str., 31337, State, Country'
};

// Currently supports 'en' and 'de' locales
const markdown = webTerms('en', options);

Options

appPrivacy

export type Options = {
  company: string,
  email: string,
  appName: string,
  minimumAge?: number,
  updated?: string,
  version?: string,
  conditions?: {
    shop?: boolean,
    tracking?: boolean,
    retargeting?: boolean,
    gdpr?: boolean,
  },
};

appTerms

export type Options = {
  company: string,
  email: string,
  appName: string,
  updated?: string,
  version?: string,
  country?: string,
  conditions?: {
    shop?: boolean,
  },
};

webPrivacy

export type Options = {
  company: string,
  email: string,
  minimumAge?: number,
  updated?: string,
  version?: string,
  website: string,
  conditions?: {
    shop?: boolean,
    tracking?: boolean,
    retargeting?: boolean,
    gdpr?: boolean,
  },
};

webTerms

export type Options = {
  company: string,
  email: string,
  updated?: string,
  version?: string,
  website: string,
  country?: string,
  conditions?: {
    shop?: boolean,
  },
};

imprint

export type Options = {
  email: string,
  address: string,
  phone?: string,
  vat?: string,
};

Formatting output

As plain text

You can use remove-markdown module to clean up any markup:

import removeMd from 'remove-markdown';

const text = removeMd(generator('en', options));

As HTML

You can use marked to render HTML:

import marked from 'marked';

const text = marked(generator('en', options));

As a React component

You can use react-markdown to avoid dangerouslySetInnerHTML:

import React from 'react';
import ReactMarkdown from 'react-markdown';

const node = <ReactMarkdown>{generator('en', options)}</ReactMarkdown>;

Package Sidebar

Install

npm i @entva/openterms

Weekly Downloads

7

Version

1.8.0

License

MIT

Unpacked Size

1.06 MB

Total Files

35

Last publish

Collaborators

  • suprmax