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 1.1.3 to 2.0.0

index.d.ts

47

index.js

@@ -1,32 +0,29 @@

'use strict'
/**
* 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
module.exports = quotation
if (Array.isArray(value)) {
while (++index < value.length) {
result[index] = start + value[index] + end
}
var C_DEFAULT = '"'
return result
}
function quotation(value, open, close) {
var result
var index
var length
open = open || C_DEFAULT
close = close || open
if (typeof value === 'string') {
return open + value + close
return start + value + end
}
if (typeof value !== 'object' || !('length' in value)) {
throw new Error('Expected string or array of strings')
}
result = []
length = value.length
index = -1
while (++index < length) {
result[index] = quotation(value[index], open, close)
}
return result
throw new TypeError('Expected string or array of strings')
}
{
"name": "quotation",
"version": "1.1.3",
"version": "2.0.0",
"description": "Quote a value",

@@ -29,31 +29,30 @@ "license": "MIT",

],
"sideEffects": false,
"type": "module",
"main": "index.js",
"types": "index.d.ts",
"files": [
"index.d.ts",
"index.js"
],
"dependencies": {},
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^15.0.0",
"prettier": "^1.0.0",
"remark-cli": "^7.0.0",
"remark-preset-wooorm": "^6.0.0",
"tape": "^4.0.0",
"tinyify": "^2.0.0",
"xo": "^0.25.0"
"@types/tape": "^4.0.0",
"c8": "^7.0.0",
"prettier": "^2.0.0",
"remark-cli": "^9.0.0",
"remark-preset-wooorm": "^8.0.0",
"rimraf": "^3.0.0",
"tape": "^5.0.0",
"type-coverage": "^2.0.0",
"typescript": "^4.0.0",
"xo": "^0.38.0"
},
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s quotation -o quotation.js",
"build-mangle": "browserify . -s quotation -p tinyify -o quotation.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
"prepack": "npm run build && npm run format",
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"test-api": "node test.js",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js",
"test": "npm run build && npm run format && npm run test-coverage"
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"prettier": {

@@ -69,6 +68,6 @@ "tabWidth": 2,

"prettier": true,
"esnext": false,
"ignore": [
"quotation.js"
]
"rules": {
"no-var": "off",
"prefer-arrow-callback": "off"
}
},

@@ -79,3 +78,8 @@ "remarkConfig": {

]
},
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true
}
}

@@ -12,2 +12,5 @@ # quotation

This package is ESM only: Node 12+ is needed to use it and it must be `import`ed
instead of `require`d.
[npm][]:

@@ -22,3 +25,3 @@

```js
var quotation = require('quotation')
import {quotation} from 'quotation'

@@ -33,2 +36,5 @@ quotation('one') // => '"one"'

This package exports the following identifiers: `quotation`.
There is no default export.
### `quotation(value[, open[, close]])`

@@ -40,3 +46,3 @@

* `value` (`string` or `Array.<string>`)
* `value` (`string` or `string[]`)
— Value to wrap in quotes

@@ -54,5 +60,5 @@ * `open` (`string`, default: `"`)

[build-badge]: https://img.shields.io/travis/wooorm/quotation.svg
[build-badge]: https://github.com/wooorm/quotation/workflows/main/badge.svg
[build]: https://travis-ci.org/wooorm/quotation
[build]: https://github.com/wooorm/quotation/actions

@@ -59,0 +65,0 @@ [coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/quotation.svg

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