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

mrp-url-generator

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mrp-url-generator

Isomorphic library to generate URLs used across MR PORTER sites

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by150%
Maintainers
1
Weekly downloads
 
Created
Source

MR PORTER URL Generator Build status

An isomorphic JavaScript library to generate URLs used across the MR PORTER sites, following our agreed formatting conventions.

Usage

npm i mrp-url-generator --save

ECMAScript 6

import { buildProductDetailsUrl } from 'mrp-url-generator';

/* alternatively, one can import the entire library with:
 * import urlGen from 'mrp-url-generator'; */

ECMAScript 5

var buildProductDetailsUrl = require('mrp-url-generator').buildProductDetailsUrl;

Browser

This is confirmed to work with Browserify and Webpack.

If, unfortunately, script tag includes are the only option, one must build the distributable manually with a tool such as Browserify:

browserify dist/index.js --outfile mrp-url-generator.js

API

All methods return Strings representing relative URLs

buildProductDetailsUrl(brandUrlKey, productName, productId, locale)

Returns a product details page link e.g:

//returns '/en-gb/mens/mario_super_designer/my-3456-woouuuuderful-trou-ers-are-great/12345'
buildProductDetailsUrl('Mario_Super_Designer', 'My 3456 Ẅöőuúüűderful Trou$ers! Are great', 12345, 'en-gb');

Contributing

Setup

npm i -g babel
npm i

Babel?! Why does this project use ECMAScript 6?

  1. Harmony has a lot of useful enhancements, especially to String.prototype
  2. Once io.js has fully merged with Node.js, everything should just work!
  3. Native Harmony support is gradually improving

Tasks

  • npm run dist - compiles the distributable to ECMAScript 5
  • npm test - runs unit tests

Keywords

FAQs

Package last updated on 28 Aug 2015

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