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

content-id

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

content-id

Routines for handling contentId for TagCloud content ingestion

latest
Source
npmnpm
Version
0.0.8
Version published
Weekly downloads
7
-22.22%
Maintainers
1
Weekly downloads
 
Created
Source

contentid

Routines for handling contentId for TagCloud content ingestion.

Install

npm install content-id --save

Usage

const contentid = require('contentid');

/*
 * Make a string "URL safe" by doing the following:
 * 1) trim the string
 * 2) replace '~' with '__'
 * 3) remove anything else than [A-Za-z0-9-_.] and change the subsequent component to camelCase, e.g. 'a b' => 'aB'
 *
 * If the parameter is not a string but has toString(), call it then escape.
 */
contentid.escape('  abc abc-abc_abc.abc~abc');
//=> 'abcAbc-abc_abc.abc__abc'

/*
 * Concatenate the three components with '~' as the separator. If the last one is a number, add zero left-padding
 * until 11 digits
 */
contentid.assemble('source', 'provider name', 'articleId');
//=> 'source~providerName~articleId'

contentid.assemble('source', 'provider name', 12345);
//=> 'source~providerName~00000012345'

License

MIT © Ringier AG

Keywords

tagcloud

FAQs

Package last updated on 16 May 2018

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