JSPM

deep-blue-string

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q38017F
  • License MIT

Apply function to strings deep within data types

Package Exports

  • deep-blue-string

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (deep-blue-string) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

deep-blue-string Build Status npm version

Apply prototypes to strings deep in data types


Install

npm install --save deep-blue-string

Usage

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

//Censor data for dangerous sql strings
dbs('DROP TABLE admin', String.prototype.replace, ['DROP TABLE', 'not in my house']);
//=> '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
    • Numbers as objects
    • Booleans as objects
    • Arrays as objects
    • Regex as objects
    • Function as objects
    • Date objects
  • Number (returned unmodified)
  • Boolean (returned unmodified)
  • Undefined (returned unmodified)
  • Function (returned unmodified)
  • Symbol (returned unmodified)

License

MIT © dawsonbotsford