New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@alloc/sqlstring

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alloc/sqlstring

Simple SQL escape and format for MySQL

latest
Source
npmnpm
Version
2.3.3
Version published
Maintainers
1
Created
Source

@alloc/sqlstring

The sqlstring@2.3.3 package with:

  • TypeScript typings
  • new toJSON option

 

The toJSON option

Pass { toJSON: true } to any of the following methods…

  • escape
  • format
  • objectAsValues
  • arrayToList

…and any objects with a toJSON method will be coerced to a JSON string with it.

import { format } from "@alloc/sqlstring";

const arr = [1, 2];
arr.toJSON = () => arr;

// toJSON=false
let sql = format("?", [arr]);
assert.equal(sql, `1, 2`);

// toJSON=true
sql = format("?", [arr]);
assert.equal(sql, `'[1,2]'`);

Keywords

sqlstring

FAQs

Package last updated on 15 Apr 2022

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