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

slashf

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

slashf

Forward-slash normalization of function results via composition

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

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

slashf: forward-slash normalization via composition

This package provides a slashf(f) function used to normalize the output of any wrapped function, in the situation in which a string is returned and contains backslashes.

Example usage:

import { slashf } from 'slashf';

function myPath(myFileName) {
    return '\\my\\path\\' + myFileName;
}

const myPathNorm = slashf(myPath);

console.log(myPathNorm('myfile.txt'));

This snippet would print:

'/my/path/myfile.txt'

API

slashf(f)

Wraps a function, normalizes its output - if it's a string - and returns it.

slash(x)

Normalizes x by replacing all the slashes with forward slashes and returns it. If x is not a string it's returned as is.

Example
slash('/a\\b/c') == '/a/b/c';
slash([1, 2, 3]) == [1, 2, 3];

License

This package is distributed under the MIT license. See the LICENSE file for further information.

Keywords

FAQs

Package last updated on 07 Dec 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

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