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

glob-rewriter

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glob-rewriter

Rewrites paths, using two globs as patterns

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Build Status npm Bower

Glob rewriter

Rewrites paths, using two globs as patterns.

Replaces a mandatory placeholder in the target expression with the provided value. The mandatory placeholder is <LOCALE>.

Depends on a specific version of glob-to-regexp module, until the fix from https://github.com/fitzgen/glob-to-regexp/pull/11 is released.

Installation

$ npm install glob-rewriter --save

Usage

// Import the module
var rewriter = require('glob-rewriter');

// Set input parameters
var source = 'somefolder/**/*.js';
var target = 'some_other_folder/**/<LOCALE>/*.js';
var locale = 'ja_JP';
var path = 'somefolder/a/b/c/d/test.js';

// This will throw an exception if the input is deemed to be invalid
rewriter.validate(path, locale, source, target);

// This will actually rewrite the path
var rewritten = rewriter.rewrite(path, locale, source, target);

// prints: "some_other_folder/a/b/c/d/ja_JP/test.js"
console.log(rewritten);

Unit tests

$ npm test

FAQs

Package last updated on 08 Dec 2016

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