match-casing
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,9 +0,1 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2016 Titus Wormer | ||
* @license MIT | ||
* @module match-casing | ||
* @fileoverview Match the case of `value` to that of `base`. | ||
*/ | ||
'use strict'; | ||
@@ -10,0 +2,0 @@ |
{ | ||
"name": "match-casing", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Match the case of `value` to that of `base`", | ||
@@ -12,4 +12,4 @@ "license": "MIT", | ||
], | ||
"repository": "https://github.com/wooorm/match-casing.git", | ||
"bugs": "https://github.com/wooorm/hast-util-to-html/issues", | ||
"repository": "wooorm/match-casing", | ||
"bugs": "https://github.com/wooorm/match-casing/issues", | ||
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)", | ||
@@ -19,18 +19,17 @@ "contributors": [ | ||
], | ||
"dependencies": {}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"browserify": "^13.0.1", | ||
"browserify": "^14.1.0", | ||
"esmangle": "^1.0.1", | ||
"nyc": "^8.1.0", | ||
"remark": "^6.0.1", | ||
"remark-cli": "^2.0.0", | ||
"remark-preset-wooorm": "^1.0.0", | ||
"nyc": "^11.0.0", | ||
"remark-cli": "^4.0.0", | ||
"remark-preset-wooorm": "^3.0.0", | ||
"tape": "^4.0.0", | ||
"xo": "^0.16.0" | ||
"xo": "^0.18.0" | ||
}, | ||
"scripts": { | ||
"build-md": "remark . --quiet --frail", | ||
"build-md": "remark . -qfo", | ||
"build-bundle": "browserify index.js --bare -s matchCasing > match-casing.js", | ||
@@ -52,2 +51,3 @@ "build-mangle": "esmangle < match-casing.js > match-casing.min.js", | ||
"space": true, | ||
"esnext": false, | ||
"ignores": [ | ||
@@ -58,5 +58,6 @@ "match-casing.js" | ||
"remarkConfig": { | ||
"output": true, | ||
"presets": "wooorm" | ||
"plugins": [ | ||
"preset-wooorm" | ||
] | ||
} | ||
} |
@@ -18,19 +18,19 @@ # match-casing [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] | ||
console.log(casing('foo', 'BAZ')); // FOO | ||
console.log(casing('foo', 'Baz')); // Foo | ||
console.log(casing('foo', 'baz')); // foo | ||
console.log(casing('foo', 'BaZ')); // foo | ||
casing('foo', 'BAZ'); //=> 'FOO' | ||
casing('foo', 'Baz'); //=> 'Foo' | ||
casing('foo', 'baz'); //=> 'foo' | ||
casing('foo', 'BaZ'); //=> 'foo' | ||
console.log(casing('FOO', 'BAZ')); // FOO | ||
console.log(casing('FOO', 'Baz')); // Foo | ||
console.log(casing('FOO', 'baz')); // foo | ||
console.log(casing('FOO', 'BaZ')); // FOO | ||
casing('FOO', 'BAZ'); //=> 'FOO' | ||
casing('FOO', 'Baz'); //=> 'Foo' | ||
casing('FOO', 'baz'); //=> 'foo' | ||
casing('FOO', 'BaZ'); //=> 'FOO' | ||
console.log(casing('Foo', 'BAZ')); // FOO | ||
console.log(casing('Foo', 'Baz')); // Foo | ||
console.log(casing('Foo', 'baz')); // foo | ||
console.log(casing('Foo', 'BaZ')); // Foo | ||
casing('Foo', 'BAZ'); //=> 'FOO' | ||
casing('Foo', 'Baz'); //=> 'Foo' | ||
casing('Foo', 'baz'); //=> 'foo' | ||
casing('Foo', 'BaZ'); //=> 'Foo' | ||
console.log(casing('’90S', '’twas')); // ’90s | ||
console.log(casing('’N’', 'a')); // ’n’ | ||
casing('’90S', '’twas'); //=> '’90s' | ||
casing('’N’', 'a'); //=> '’n’' | ||
``` | ||
@@ -42,19 +42,12 @@ | ||
###### Parameters | ||
Transform the case in `value` (`string`) to match that of `base` (`string`). | ||
* `value` (`string`) — Value whose case to change. | ||
* `match` (`string`) — Value whose case to match. | ||
###### Returns | ||
`string` — `value`, but cased as `base`. | ||
## Algorithm | ||
* If `base` is uppercase, `value` is uppercased; | ||
* Else, if `base` is lowercase, `value` is lowercased; | ||
* If `base` is uppercase, `value` is uppercased | ||
* Else, if `base` is lowercase, `value` is lowercased | ||
* Else, if the first alphabetic character in `base` is uppercase, | ||
and the rest of `base` is lowercase, uppercase the first alphabetic | ||
character in `value` and lowercase the rest. | ||
* Else, return `value` unmodified. | ||
character in `value` and lowercase the rest | ||
* Else, return `value` unmodified | ||
@@ -61,0 +54,0 @@ The third case, where `value` takes on a capitalised, deals with |
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 bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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 bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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
5220
7
4
36
74