Socket
Socket
Sign inDemoInstall

deep-blue-string

Package Overview
Dependencies
2
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    deep-blue-string

Apply prototype functions to strings deep within data types


Version published
Weekly downloads
6
increased by500%
Maintainers
1
Install size
12.1 kB
Created
Weekly downloads
 

Readme

Source

deep-blue-string Build Status npm version

Apply prototype funtions to strings deep in data types


logo


Install

npm install --save deep-blue-string

Usage

const dbs = require('deep-blue-string');

//Sanitize any data type
dbs({userInput: 'DROP TABLE admin'}, String.prototype.replace, ['DROP TABLE', 'not in my house']);
//=> {userInput: 'not in my house admin'}

API

dbs(target, function, [fnArgs])

target

Required
Type: Any

function

Required
Type: function

fnArgs

Optional
Type: string || array
Description: If the user inputted function takes arguments, supply them here. For multiple arguments (like String.prototype.replace, input them as an array).

Function overview

Apply function to all strings in target. Deeply nested strings will be found and operated on. No casting will be done on inputted target.


Features

Supported target Data Types:

  • String
  • Array
  • Objects
    • Object object
    • Strings as objects
    • Arrays as objects
    • Numbers as objects (returned unmodified)
    • Booleans as objects (returned unmodified)
    • Regex as objects (returned unmodified)
    • Function as objects (returned unmodified)
    • Date objects (returned unmodified)
  • Number (returned unmodified)
  • Boolean (returned unmodified)
  • Undefined (returned unmodified)
  • Function (returned unmodified)
  • Symbol (returned unmodified)


License

MIT © dawsonbotsford

Keywords

FAQs

Last updated on 14 Feb 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc