1.0.0 • Published 7 years ago

slash-escape v1.0.0

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

slash-escape

Build Status

Slash escape paths as valid filenames. Escapes /foo/bar/baz as zSfoozSbarzSbazZ, and c:\\foo as czCzBfoo.

Usage

var slashEscape = require('slash-escape');

slashEscape.escape('/foo/bar/baz');
// zSfoozSbarzSbazZ

slashEscape.unescape('zSfoozSbarzSbazZ');
// /foo/bar/baz

About

This is a JavaScript implementation of the slash escape mechanism used by flow. https://github.com/facebook/flow/blob/22588e4e/hack/utils/path.ml#L56-L91