Comparing version 1.1.0 to 1.1.1
30
index.js
@@ -1,33 +0,33 @@ | ||
'use strict'; | ||
'use strict' | ||
module.exports = quotation; | ||
module.exports = quotation | ||
var C_DEFAULT = '"'; | ||
var C_DEFAULT = '"' | ||
/* Quote text. */ | ||
function quotation(value, open, close) { | ||
var result; | ||
var index; | ||
var length; | ||
var result | ||
var index | ||
var length | ||
open = open || C_DEFAULT; | ||
close = close || open; | ||
open = open || C_DEFAULT | ||
close = close || open | ||
if (typeof value === 'string') { | ||
return open + value + close; | ||
return open + value + close | ||
} | ||
if (typeof value !== 'object' || !('length' in value)) { | ||
throw new Error('Expected string or array of strings'); | ||
throw new Error('Expected string or array of strings') | ||
} | ||
result = []; | ||
length = value.length; | ||
index = -1; | ||
result = [] | ||
length = value.length | ||
index = -1 | ||
while (++index < length) { | ||
result[index] = quotation(value[index], open, close); | ||
result[index] = quotation(value[index], open, close) | ||
} | ||
return result; | ||
return result | ||
} |
{ | ||
"name": "quotation", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Quote a value", | ||
@@ -19,3 +19,3 @@ "license": "MIT", | ||
], | ||
"repository": "https://github.com/wooorm/quotation", | ||
"repository": "wooorm/quotation", | ||
"bugs": "https://github.com/wooorm/quotation/issues", | ||
@@ -28,19 +28,19 @@ "author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)", | ||
"devDependencies": { | ||
"browserify": "^13.0.0", | ||
"browserify": "^16.0.0", | ||
"esmangle": "^1.0.0", | ||
"nyc": "^9.0.1", | ||
"remark-cli": "^2.1.0", | ||
"remark-preset-wooorm": "^1.0.0", | ||
"nyc": "^11.0.0", | ||
"prettier": "^1.12.1", | ||
"remark-cli": "^5.0.0", | ||
"remark-preset-wooorm": "^4.0.0", | ||
"tape": "^4.0.0", | ||
"xo": "^0.17.1" | ||
"xo": "^0.20.0" | ||
}, | ||
"scripts": { | ||
"build-md": "remark . --quiet --frail --output", | ||
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix", | ||
"build-bundle": "browserify index.js --bare -s quotation > quotation.js", | ||
"build-mangle": "esmangle quotation.js > quotation.min.js", | ||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", | ||
"lint": "xo", | ||
"test-api": "node test.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 build && npm run lint && npm run test-coverage" | ||
"test": "npm run format && npm run build && npm run test-coverage" | ||
}, | ||
@@ -53,4 +53,17 @@ "nyc": { | ||
}, | ||
"prettier": { | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"singleQuote": true, | ||
"bracketSpacing": false, | ||
"semi": false, | ||
"trailingComma": "none" | ||
}, | ||
"xo": { | ||
"space": true, | ||
"prettier": true, | ||
"esnext": false, | ||
"rules": { | ||
"no-var": "off", | ||
"prefer-arrow-callback": "off" | ||
}, | ||
"ignore": [ | ||
@@ -61,4 +74,6 @@ "quotation.js" | ||
"remarkConfig": { | ||
"presets": "wooorm" | ||
"plugins": [ | ||
"preset-wooorm" | ||
] | ||
} | ||
} |
@@ -16,8 +16,8 @@ # quotation [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] | ||
```js | ||
var quotation = require('quotation'); | ||
var quotation = require('quotation') | ||
quotation('one'); //=> '"one"' | ||
quotation(['one', 'two']); //=> ['"one"', '"two"'] | ||
quotation('one', '\''); //=> '\'one\'' | ||
quotation('one', '“', '”'); //=> '“one”' | ||
quotation('one') // => '"one"' | ||
quotation(['one', 'two']) // => ['"one"', '"two"'] | ||
quotation('one', "'") // => '\'one\'' | ||
quotation('one', '“', '”') // => '“one”' | ||
``` | ||
@@ -34,7 +34,7 @@ | ||
* `value` (`string` or `Array.<string>`) | ||
— Value to wrap in quotes; | ||
— Value to wrap in quotes | ||
* `open` (`string`, default: `"`) | ||
— Character to add at start of `value`; | ||
— Character to add at start of `value` | ||
* `close` (`string`, default: `open` or `"`) | ||
— Character to add at end of `value`. | ||
— Character to add at end of `value` | ||
@@ -41,0 +41,0 @@ ## License |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
4527
8