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

quotation

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quotation - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

21

index.d.ts

@@ -1,13 +0,8 @@

/**
* Quote a value.
*
* @param {string | string[]} value Value(s) to wrap in quotes
* @param {string} [open='"'] Opening quote
* @param {string} [close=open] Closing quote
* @returns {string | string[]}
*/
export function quotation(
value: string | string[],
open?: string,
close?: string
): string | string[]
/** @type {{
* (value: string, open?: string, close?: string): string
* (value: string[], open?: string, close?: string): string[]
* }} */
export var quotation: {
(value: string, open?: string, close?: string): string
(value: string[], open?: string, close?: string): string[]
}

@@ -1,29 +0,36 @@

/**
* Quote a value.
*
* @param {string | string[]} value Value(s) to wrap in quotes
* @param {string} [open='"'] Opening quote
* @param {string} [close=open] Closing quote
* @returns {string | string[]}
*/
export function quotation(value, open, close) {
var start = open || '"'
var end = close || start
/** @type {string[]} */
var result = []
var index = -1
// prettier-ignore
/** @type {{
* (value: string, open?: string, close?: string): string
* (value: string[], open?: string, close?: string): string[]
* }} */
export var quotation = (
/**
* Quote a value.
*
* @param {string | string[]} value Value(s) to wrap in quotes
* @param {string} [open='"'] Opening quote
* @param {string} [close=open] Closing quote
* @returns {string | string[]}
*/
function (value, open, close) {
var start = open || '"'
var end = close || start
/** @type {string[]} */
var result = []
var index = -1
if (Array.isArray(value)) {
while (++index < value.length) {
result[index] = start + value[index] + end
if (Array.isArray(value)) {
while (++index < value.length) {
result[index] = start + value[index] + end
}
return result
}
return result
}
if (typeof value === 'string') {
return start + value + end
}
if (typeof value === 'string') {
return start + value + end
throw new TypeError('Expected string or array of strings')
}
throw new TypeError('Expected string or array of strings')
}
)
{
"name": "quotation",
"version": "2.0.0",
"version": "2.0.1",
"description": "Quote a value",

@@ -68,2 +68,3 @@ "license": "MIT",

"rules": {
"import/no-mutable-exports": "off",
"no-var": "off",

@@ -70,0 +71,0 @@ "prefer-arrow-callback": "off"

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