Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dhar/url-courte

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

@dhar/url-courte

My own super simple algorithmically reversible, personal URL shortener.

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

url-courte

My own super simple algorithmically reversible, personal URL shortener.

npm npm

Inpired by :

Installation

npm install @dhar/url-courte

Usage

shorten(date, category, ordinal)

Converts a published date, category, and ordinal into a url-courte URL fragment.

import { shorten } from '@dhar/url-courte'

const d = new Date('2023-02-03')
const shortenedFragment = shorten('articles', d, 1)
// --> returns 'a202302031'
parameters
  • category: named category, typically something like 'articles', 'notes', 'pictures', or anything that make sense on your website/blog
  • date: A JS Date object, typically the publication date.
  • ordinal: a digit to indicate the nth ordinal post of that type for that day

expand(fragment, [categoryMapping])

Converts a shortened URL fragment (i.e. 'a202301082') into an expanded url-courte URL fragment (i.e. 'articles/2023/01/08/2'). Return an empty string if the provided fragment doesn't match the expected format.

import { expand } from '@dhar/url-courte'

const d = new Date('2023-02-03')
const expandedFragment = expand('a202301182', {
	'a': 'articles',
	'n': 'notes',
})
// --> returns 'articles/2023/01/18/2'
parameters
  • fragment: the short URL fragment to expand
  • categoryMapping (optional): A mapping to match the first letter of the fragment. If ommitted, the single letter from the fragment is used.

Keywords

FAQs

Package last updated on 26 Jan 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc