New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@pyyupsk/copyright

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pyyupsk/copyright

A framework-agnostic TypeScript library for displaying copyright notices with auto year calculation, preset formats, custom templates, and React support

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

@pyyupsk/copyright

CI License: MIT npm

A framework-agnostic TypeScript library for displaying copyright notices with auto year calculation, preset formats, custom templates, and React support.

Features

  • Auto year calculation with year ranges
  • 4 preset formats (minimal, standard, full, legal)
  • Custom template support with variable substitution
  • HTML output with styling (className, style, tag)
  • React component with declarative props API
  • Direct DOM rendering via selector or Element reference
  • Zero runtime dependencies for core library
  • Dual ESM/CJS output
  • Full TypeScript support

Installation

npm install @pyyupsk/copyright
# or
bun add @pyyupsk/copyright

Quick Start

Basic Usage

import { Copyright } from "@pyyupsk/copyright";

const copyright = new Copyright({ owner: "ACME Corp" });
console.log(copyright.getText()); // © 2026 ACME Corp

Year Range

const copyright = new Copyright({
  owner: "ACME Corp",
  startYear: 2020,
});
console.log(copyright.getText()); // © 2020-2026 ACME Corp

Preset Formats

const copyright = new Copyright({
  owner: "ACME Corp",
  format: "standard",
});
console.log(copyright.getText()); // Copyright © 2026 ACME Corp

// Available formats: minimal, standard, full, legal

Custom Template

const copyright = new Copyright({
  owner: "ACME Corp",
  template: "Made by {owner} in {year}",
});
console.log(copyright.getText()); // Made by ACME Corp in 2026

// Available variables: {symbol}, {year}, {owner}, {startYear}, {endYear}

HTML Output

const copyright = new Copyright({ owner: "ACME Corp" });

// Default span
console.log(copyright.toHTML());
// <span>© 2026 ACME Corp</span>

// With options
console.log(
  copyright.toHTML({
    tag: "footer",
    className: "copyright-text",
    style: { color: "gray" },
  }),
);
// <footer class="copyright-text" style="color: gray">© 2026 ACME Corp</footer>

DOM Rendering

const copyright = new Copyright({ owner: "ACME Corp" });

// Render to selector
copyright.render("#footer");

// Render to Element
const container = document.getElementById("footer");
copyright.render(container, { tag: "small", className: "text-muted" });

React Component

import { Copyright } from "@pyyupsk/copyright/react";

function Footer() {
  return (
    <Copyright
      owner="ACME Corp"
      startYear={2020}
      format="standard"
      as="footer"
      className="text-gray-500"
    />
  );
}

API Reference

Constructor

new Copyright(options: CopyrightOptions);

Options

OptionTypeDefaultDescription
ownerstring(required)Copyright owner name
startYearnumbercurrentStart year for range
endYearnumber | "auto""auto"End year (auto = current)
format"minimal" | "standard" | "full" | "legal""minimal"Preset format
templatestring-Custom template (overrides)

Methods

  • getText() - Returns plain text copyright string
  • toHTML(options?) - Returns HTML string with optional tag, className, style
  • render(target, options?) - Renders to DOM element (selector or Element)
  • setOptions(options) - Updates options (chainable)
  • static create(options) - Factory method

All CopyrightOptions plus:

PropTypeDefaultDescription
asstring"span"Element type
tagstring"span"Alias for as
classNamestring-CSS class
styleobject-Inline styles

License

MIT

Keywords

copyright

FAQs

Package last updated on 18 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts