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

@commitlint/rules

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commitlint/rules - npm Package Compare versions

Comparing version 6.1.3 to 6.2.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

<a name="6.2.0"></a>
# [6.2.0](https://github.com/marionebl/commitlint/compare/v6.1.3...v6.2.0) (2018-05-01)
### Features
* **rules:** support array for scope-case and type-case ([#312](https://github.com/marionebl/commitlint/issues/312)) ([1f46b9f](https://github.com/marionebl/commitlint/commit/1f46b9f)), closes [#307](https://github.com/marionebl/commitlint/issues/307)
<a name="6.1.1"></a>

@@ -8,0 +19,0 @@ ## [6.1.1](https://github.com/marionebl/commitlint/compare/v6.1.0...v6.1.1) (2018-02-22)

26

lib/scope-case.js

@@ -19,2 +19,6 @@ 'use strict';

var negated = function negated(when) {
return when === 'never';
};
exports.default = function (parsed, when, value) {

@@ -28,6 +32,22 @@ var scope = parsed.scope;

var negated = when === 'never';
var checks = (Array.isArray(value) ? value : [value]).map(function (check) {
if (typeof check === 'string') {
return {
when: 'always',
case: check
};
}
return check;
});
var result = ensure.case(scope, value);
return [negated ? !result : result, (0, _message2.default)([`scope must`, negated ? `not` : null, `be ${value}`])];
var result = checks.some(function (check) {
var r = ensure.case(scope, check.case);
return negated(check.when) ? !r : r;
});
var list = checks.map(function (c) {
return c.case;
}).join(', ');
return [negated(when) ? !result : result, (0, _message2.default)([`scope must`, negated(when) ? `not` : null, `be ${list}`])];
};

@@ -34,0 +54,0 @@

190

lib/scope-case.test.js

@@ -15,5 +15,5 @@ 'use strict';

var _scopeCase77 = require('./scope-case');
var _scopeCase89 = require('./scope-case');
var _scopeCase78 = _interopRequireDefault(_scopeCase77);
var _scopeCase90 = _interopRequireDefault(_scopeCase89);

@@ -52,3 +52,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

try {
_scopeCase = (0, _scopeCase78.default)($await_1, 'never', 'lowercase'), _scopeCase2 = (0, _slicedToArray3.default)(_scopeCase, 1), actual = _scopeCase2[0];
_scopeCase = (0, _scopeCase90.default)($await_1, 'never', 'lowercase'), _scopeCase2 = (0, _slicedToArray3.default)(_scopeCase, 1), actual = _scopeCase2[0];

@@ -71,3 +71,3 @@ expected = true;

try {
_scopeCase3 = (0, _scopeCase78.default)($await_2, 'always', 'lowercase'), _scopeCase4 = (0, _slicedToArray3.default)(_scopeCase3, 1), actual = _scopeCase4[0];
_scopeCase3 = (0, _scopeCase90.default)($await_2, 'always', 'lowercase'), _scopeCase4 = (0, _slicedToArray3.default)(_scopeCase3, 1), actual = _scopeCase4[0];

@@ -90,3 +90,3 @@ expected = true;

try {
_scopeCase5 = (0, _scopeCase78.default)($await_3, 'never', 'uppercase'), _scopeCase6 = (0, _slicedToArray3.default)(_scopeCase5, 1), actual = _scopeCase6[0];
_scopeCase5 = (0, _scopeCase90.default)($await_3, 'never', 'uppercase'), _scopeCase6 = (0, _slicedToArray3.default)(_scopeCase5, 1), actual = _scopeCase6[0];

@@ -109,3 +109,3 @@ expected = true;

try {
_scopeCase7 = (0, _scopeCase78.default)($await_4, 'always', 'uppercase'), _scopeCase8 = (0, _slicedToArray3.default)(_scopeCase7, 1), actual = _scopeCase8[0];
_scopeCase7 = (0, _scopeCase90.default)($await_4, 'always', 'uppercase'), _scopeCase8 = (0, _slicedToArray3.default)(_scopeCase7, 1), actual = _scopeCase8[0];

@@ -128,3 +128,3 @@ expected = true;

try {
_scopeCase9 = (0, _scopeCase78.default)($await_5, 'never', 'camel-case'), _scopeCase10 = (0, _slicedToArray3.default)(_scopeCase9, 1), actual = _scopeCase10[0];
_scopeCase9 = (0, _scopeCase90.default)($await_5, 'never', 'camel-case'), _scopeCase10 = (0, _slicedToArray3.default)(_scopeCase9, 1), actual = _scopeCase10[0];

@@ -147,3 +147,3 @@ expected = true;

try {
_scopeCase11 = (0, _scopeCase78.default)($await_6, 'never', 'camel-case'), _scopeCase12 = (0, _slicedToArray3.default)(_scopeCase11, 1), actual = _scopeCase12[0];
_scopeCase11 = (0, _scopeCase90.default)($await_6, 'never', 'camel-case'), _scopeCase12 = (0, _slicedToArray3.default)(_scopeCase11, 1), actual = _scopeCase12[0];

@@ -166,3 +166,3 @@ expected = true;

try {
_scopeCase13 = (0, _scopeCase78.default)($await_7, 'never', 'kebab-case'), _scopeCase14 = (0, _slicedToArray3.default)(_scopeCase13, 1), actual = _scopeCase14[0];
_scopeCase13 = (0, _scopeCase90.default)($await_7, 'never', 'kebab-case'), _scopeCase14 = (0, _slicedToArray3.default)(_scopeCase13, 1), actual = _scopeCase14[0];

@@ -185,3 +185,3 @@ expected = true;

try {
_scopeCase15 = (0, _scopeCase78.default)($await_8, 'never', 'kebab-case'), _scopeCase16 = (0, _slicedToArray3.default)(_scopeCase15, 1), actual = _scopeCase16[0];
_scopeCase15 = (0, _scopeCase90.default)($await_8, 'never', 'kebab-case'), _scopeCase16 = (0, _slicedToArray3.default)(_scopeCase15, 1), actual = _scopeCase16[0];

@@ -204,3 +204,3 @@ expected = true;

try {
_scopeCase17 = (0, _scopeCase78.default)($await_9, 'never', 'pascal-case'), _scopeCase18 = (0, _slicedToArray3.default)(_scopeCase17, 1), actual = _scopeCase18[0];
_scopeCase17 = (0, _scopeCase90.default)($await_9, 'never', 'pascal-case'), _scopeCase18 = (0, _slicedToArray3.default)(_scopeCase17, 1), actual = _scopeCase18[0];

@@ -223,3 +223,3 @@ expected = true;

try {
_scopeCase19 = (0, _scopeCase78.default)($await_10, 'never', 'pascal-case'), _scopeCase20 = (0, _slicedToArray3.default)(_scopeCase19, 1), actual = _scopeCase20[0];
_scopeCase19 = (0, _scopeCase90.default)($await_10, 'never', 'pascal-case'), _scopeCase20 = (0, _slicedToArray3.default)(_scopeCase19, 1), actual = _scopeCase20[0];

@@ -242,3 +242,3 @@ expected = true;

try {
_scopeCase21 = (0, _scopeCase78.default)($await_11, 'never', 'snake-case'), _scopeCase22 = (0, _slicedToArray3.default)(_scopeCase21, 1), actual = _scopeCase22[0];
_scopeCase21 = (0, _scopeCase90.default)($await_11, 'never', 'snake-case'), _scopeCase22 = (0, _slicedToArray3.default)(_scopeCase21, 1), actual = _scopeCase22[0];

@@ -261,3 +261,3 @@ expected = true;

try {
_scopeCase23 = (0, _scopeCase78.default)($await_12, 'never', 'snake-case'), _scopeCase24 = (0, _slicedToArray3.default)(_scopeCase23, 1), actual = _scopeCase24[0];
_scopeCase23 = (0, _scopeCase90.default)($await_12, 'never', 'snake-case'), _scopeCase24 = (0, _slicedToArray3.default)(_scopeCase23, 1), actual = _scopeCase24[0];

@@ -280,3 +280,3 @@ expected = true;

try {
_scopeCase25 = (0, _scopeCase78.default)($await_13, 'never', 'start-case'), _scopeCase26 = (0, _slicedToArray3.default)(_scopeCase25, 1), actual = _scopeCase26[0];
_scopeCase25 = (0, _scopeCase90.default)($await_13, 'never', 'start-case'), _scopeCase26 = (0, _slicedToArray3.default)(_scopeCase25, 1), actual = _scopeCase26[0];

@@ -299,3 +299,3 @@ expected = true;

try {
_scopeCase27 = (0, _scopeCase78.default)($await_14, 'never', 'start-case'), _scopeCase28 = (0, _slicedToArray3.default)(_scopeCase27, 1), actual = _scopeCase28[0];
_scopeCase27 = (0, _scopeCase90.default)($await_14, 'never', 'start-case'), _scopeCase28 = (0, _slicedToArray3.default)(_scopeCase27, 1), actual = _scopeCase28[0];

@@ -318,3 +318,3 @@ expected = true;

try {
_scopeCase29 = (0, _scopeCase78.default)($await_15, 'never', 'lowercase'), _scopeCase30 = (0, _slicedToArray3.default)(_scopeCase29, 1), actual = _scopeCase30[0];
_scopeCase29 = (0, _scopeCase90.default)($await_15, 'never', 'lowercase'), _scopeCase30 = (0, _slicedToArray3.default)(_scopeCase29, 1), actual = _scopeCase30[0];

@@ -337,3 +337,3 @@ expected = false;

try {
_scopeCase31 = (0, _scopeCase78.default)($await_16, 'always', 'lowercase'), _scopeCase32 = (0, _slicedToArray3.default)(_scopeCase31, 1), actual = _scopeCase32[0];
_scopeCase31 = (0, _scopeCase90.default)($await_16, 'always', 'lowercase'), _scopeCase32 = (0, _slicedToArray3.default)(_scopeCase31, 1), actual = _scopeCase32[0];

@@ -356,3 +356,3 @@ expected = true;

try {
_scopeCase33 = (0, _scopeCase78.default)($await_17, 'never', 'lowercase'), _scopeCase34 = (0, _slicedToArray3.default)(_scopeCase33, 1), actual = _scopeCase34[0];
_scopeCase33 = (0, _scopeCase90.default)($await_17, 'never', 'lowercase'), _scopeCase34 = (0, _slicedToArray3.default)(_scopeCase33, 1), actual = _scopeCase34[0];

@@ -375,3 +375,3 @@ expected = true;

try {
_scopeCase35 = (0, _scopeCase78.default)($await_18, 'always', 'lowercase'), _scopeCase36 = (0, _slicedToArray3.default)(_scopeCase35, 1), actual = _scopeCase36[0];
_scopeCase35 = (0, _scopeCase90.default)($await_18, 'always', 'lowercase'), _scopeCase36 = (0, _slicedToArray3.default)(_scopeCase35, 1), actual = _scopeCase36[0];

@@ -394,3 +394,3 @@ expected = false;

try {
_scopeCase37 = (0, _scopeCase78.default)($await_19, 'never', 'uppercase'), _scopeCase38 = (0, _slicedToArray3.default)(_scopeCase37, 1), actual = _scopeCase38[0];
_scopeCase37 = (0, _scopeCase90.default)($await_19, 'never', 'uppercase'), _scopeCase38 = (0, _slicedToArray3.default)(_scopeCase37, 1), actual = _scopeCase38[0];

@@ -413,3 +413,3 @@ expected = true;

try {
_scopeCase39 = (0, _scopeCase78.default)($await_20, 'always', 'lowercase'), _scopeCase40 = (0, _slicedToArray3.default)(_scopeCase39, 1), actual = _scopeCase40[0];
_scopeCase39 = (0, _scopeCase90.default)($await_20, 'always', 'lowercase'), _scopeCase40 = (0, _slicedToArray3.default)(_scopeCase39, 1), actual = _scopeCase40[0];

@@ -432,3 +432,3 @@ expected = true;

try {
_scopeCase41 = (0, _scopeCase78.default)($await_21, 'always', 'camel-case'), _scopeCase42 = (0, _slicedToArray3.default)(_scopeCase41, 1), actual = _scopeCase42[0];
_scopeCase41 = (0, _scopeCase90.default)($await_21, 'always', 'camel-case'), _scopeCase42 = (0, _slicedToArray3.default)(_scopeCase41, 1), actual = _scopeCase42[0];

@@ -451,3 +451,3 @@ expected = false;

try {
_scopeCase43 = (0, _scopeCase78.default)($await_22, 'always', 'pascal-case'), _scopeCase44 = (0, _slicedToArray3.default)(_scopeCase43, 1), actual = _scopeCase44[0];
_scopeCase43 = (0, _scopeCase90.default)($await_22, 'always', 'pascal-case'), _scopeCase44 = (0, _slicedToArray3.default)(_scopeCase43, 1), actual = _scopeCase44[0];

@@ -470,3 +470,3 @@ expected = false;

try {
_scopeCase45 = (0, _scopeCase78.default)($await_23, 'always', 'kebab-case'), _scopeCase46 = (0, _slicedToArray3.default)(_scopeCase45, 1), actual = _scopeCase46[0];
_scopeCase45 = (0, _scopeCase90.default)($await_23, 'always', 'kebab-case'), _scopeCase46 = (0, _slicedToArray3.default)(_scopeCase45, 1), actual = _scopeCase46[0];

@@ -489,3 +489,3 @@ expected = true;

try {
_scopeCase47 = (0, _scopeCase78.default)($await_24, 'always', 'lowercase'), _scopeCase48 = (0, _slicedToArray3.default)(_scopeCase47, 1), actual = _scopeCase48[0];
_scopeCase47 = (0, _scopeCase90.default)($await_24, 'always', 'lowercase'), _scopeCase48 = (0, _slicedToArray3.default)(_scopeCase47, 1), actual = _scopeCase48[0];

@@ -508,3 +508,3 @@ expected = true;

try {
_scopeCase49 = (0, _scopeCase78.default)($await_25, 'always', 'camel-case'), _scopeCase50 = (0, _slicedToArray3.default)(_scopeCase49, 1), actual = _scopeCase50[0];
_scopeCase49 = (0, _scopeCase90.default)($await_25, 'always', 'camel-case'), _scopeCase50 = (0, _slicedToArray3.default)(_scopeCase49, 1), actual = _scopeCase50[0];

@@ -527,3 +527,3 @@ expected = false;

try {
_scopeCase51 = (0, _scopeCase78.default)($await_26, 'always', 'pascal-case'), _scopeCase52 = (0, _slicedToArray3.default)(_scopeCase51, 1), actual = _scopeCase52[0];
_scopeCase51 = (0, _scopeCase90.default)($await_26, 'always', 'pascal-case'), _scopeCase52 = (0, _slicedToArray3.default)(_scopeCase51, 1), actual = _scopeCase52[0];

@@ -546,3 +546,3 @@ expected = false;

try {
_scopeCase53 = (0, _scopeCase78.default)($await_27, 'always', 'snake-case'), _scopeCase54 = (0, _slicedToArray3.default)(_scopeCase53, 1), actual = _scopeCase54[0];
_scopeCase53 = (0, _scopeCase90.default)($await_27, 'always', 'snake-case'), _scopeCase54 = (0, _slicedToArray3.default)(_scopeCase53, 1), actual = _scopeCase54[0];

@@ -565,3 +565,3 @@ expected = true;

try {
_scopeCase55 = (0, _scopeCase78.default)($await_28, 'always', 'lowercase'), _scopeCase56 = (0, _slicedToArray3.default)(_scopeCase55, 1), actual = _scopeCase56[0];
_scopeCase55 = (0, _scopeCase90.default)($await_28, 'always', 'lowercase'), _scopeCase56 = (0, _slicedToArray3.default)(_scopeCase55, 1), actual = _scopeCase56[0];

@@ -584,3 +584,3 @@ expected = false;

try {
_scopeCase57 = (0, _scopeCase78.default)($await_29, 'always', 'camel-case'), _scopeCase58 = (0, _slicedToArray3.default)(_scopeCase57, 1), actual = _scopeCase58[0];
_scopeCase57 = (0, _scopeCase90.default)($await_29, 'always', 'camel-case'), _scopeCase58 = (0, _slicedToArray3.default)(_scopeCase57, 1), actual = _scopeCase58[0];

@@ -603,3 +603,3 @@ expected = true;

try {
_scopeCase59 = (0, _scopeCase78.default)($await_30, 'always', 'kebab-case'), _scopeCase60 = (0, _slicedToArray3.default)(_scopeCase59, 1), actual = _scopeCase60[0];
_scopeCase59 = (0, _scopeCase90.default)($await_30, 'always', 'kebab-case'), _scopeCase60 = (0, _slicedToArray3.default)(_scopeCase59, 1), actual = _scopeCase60[0];

@@ -622,3 +622,3 @@ expected = false;

try {
_scopeCase61 = (0, _scopeCase78.default)($await_31, 'always', 'pascal-case'), _scopeCase62 = (0, _slicedToArray3.default)(_scopeCase61, 1), actual = _scopeCase62[0];
_scopeCase61 = (0, _scopeCase90.default)($await_31, 'always', 'pascal-case'), _scopeCase62 = (0, _slicedToArray3.default)(_scopeCase61, 1), actual = _scopeCase62[0];

@@ -641,3 +641,3 @@ expected = false;

try {
_scopeCase63 = (0, _scopeCase78.default)($await_32, 'always', 'lowercase'), _scopeCase64 = (0, _slicedToArray3.default)(_scopeCase63, 1), actual = _scopeCase64[0];
_scopeCase63 = (0, _scopeCase90.default)($await_32, 'always', 'lowercase'), _scopeCase64 = (0, _slicedToArray3.default)(_scopeCase63, 1), actual = _scopeCase64[0];

@@ -660,3 +660,3 @@ expected = false;

try {
_scopeCase65 = (0, _scopeCase78.default)($await_33, 'always', 'kebab-case'), _scopeCase66 = (0, _slicedToArray3.default)(_scopeCase65, 1), actual = _scopeCase66[0];
_scopeCase65 = (0, _scopeCase90.default)($await_33, 'always', 'kebab-case'), _scopeCase66 = (0, _slicedToArray3.default)(_scopeCase65, 1), actual = _scopeCase66[0];

@@ -679,3 +679,3 @@ expected = false;

try {
_scopeCase67 = (0, _scopeCase78.default)($await_34, 'always', 'camel-case'), _scopeCase68 = (0, _slicedToArray3.default)(_scopeCase67, 1), actual = _scopeCase68[0];
_scopeCase67 = (0, _scopeCase90.default)($await_34, 'always', 'camel-case'), _scopeCase68 = (0, _slicedToArray3.default)(_scopeCase67, 1), actual = _scopeCase68[0];

@@ -698,3 +698,3 @@ expected = false;

try {
_scopeCase69 = (0, _scopeCase78.default)($await_35, 'always', 'pascal-case'), _scopeCase70 = (0, _slicedToArray3.default)(_scopeCase69, 1), actual = _scopeCase70[0];
_scopeCase69 = (0, _scopeCase90.default)($await_35, 'always', 'pascal-case'), _scopeCase70 = (0, _slicedToArray3.default)(_scopeCase69, 1), actual = _scopeCase70[0];

@@ -717,3 +717,3 @@ expected = true;

try {
_scopeCase71 = (0, _scopeCase78.default)($await_36, 'always', 'uppercase'), _scopeCase72 = (0, _slicedToArray3.default)(_scopeCase71, 1), actual = _scopeCase72[0];
_scopeCase71 = (0, _scopeCase90.default)($await_36, 'always', 'uppercase'), _scopeCase72 = (0, _slicedToArray3.default)(_scopeCase71, 1), actual = _scopeCase72[0];

@@ -736,3 +736,3 @@ expected = false;

try {
_scopeCase73 = (0, _scopeCase78.default)($await_37, 'never', 'uppercase'), _scopeCase74 = (0, _slicedToArray3.default)(_scopeCase73, 1), actual = _scopeCase74[0];
_scopeCase73 = (0, _scopeCase90.default)($await_37, 'never', 'uppercase'), _scopeCase74 = (0, _slicedToArray3.default)(_scopeCase73, 1), actual = _scopeCase74[0];

@@ -749,3 +749,3 @@ expected = false;

(0, _ava2.default)('with lowercase scope should succeed for "always uppercase"', function (t) {
(0, _ava2.default)('with uppercase scope should succeed for "always uppercase"', function (t) {
return new Promise(function ($return, $error) {

@@ -756,3 +756,3 @@ var _scopeCase75, _scopeCase76, actual, expected;

try {
_scopeCase75 = (0, _scopeCase78.default)($await_38, 'always', 'uppercase'), _scopeCase76 = (0, _slicedToArray3.default)(_scopeCase75, 1), actual = _scopeCase76[0];
_scopeCase75 = (0, _scopeCase90.default)($await_38, 'always', 'uppercase'), _scopeCase76 = (0, _slicedToArray3.default)(_scopeCase75, 1), actual = _scopeCase76[0];

@@ -768,2 +768,110 @@ expected = true;

});
(0, _ava2.default)('with uppercase scope should succeed for "always [uppercase, lowercase]"', function (t) {
return new Promise(function ($return, $error) {
var _scopeCase77, _scopeCase78, actual, expected;
return Promise.resolve(parsed.uppercase).then(function ($await_39) {
try {
_scopeCase77 = (0, _scopeCase90.default)($await_39, 'always', ['uppercase', 'lowercase']), _scopeCase78 = (0, _slicedToArray3.default)(_scopeCase77, 1), actual = _scopeCase78[0];
expected = true;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('with lowercase scope should succeed for "always [uppercase, lowercase]"', function (t) {
return new Promise(function ($return, $error) {
var _scopeCase79, _scopeCase80, actual, expected;
return Promise.resolve(parsed.lowercase).then(function ($await_40) {
try {
_scopeCase79 = (0, _scopeCase90.default)($await_40, 'always', ['uppercase', 'lowercase']), _scopeCase80 = (0, _slicedToArray3.default)(_scopeCase79, 1), actual = _scopeCase80[0];
expected = true;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('with mixedcase scope should fail for "always [uppercase, lowercase]"', function (t) {
return new Promise(function ($return, $error) {
var _scopeCase81, _scopeCase82, actual, expected;
return Promise.resolve(parsed.mixedcase).then(function ($await_41) {
try {
_scopeCase81 = (0, _scopeCase90.default)($await_41, 'always', ['uppercase', 'lowercase']), _scopeCase82 = (0, _slicedToArray3.default)(_scopeCase81, 1), actual = _scopeCase82[0];
expected = false;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('with mixedcase scope should pass for "always [uppercase, lowercase, camel-case]"', function (t) {
return new Promise(function ($return, $error) {
var _scopeCase83, _scopeCase84, actual, expected;
return Promise.resolve(parsed.mixedcase).then(function ($await_42) {
try {
_scopeCase83 = (0, _scopeCase90.default)($await_42, 'always', ['uppercase', 'lowercase', 'camel-case']), _scopeCase84 = (0, _slicedToArray3.default)(_scopeCase83, 1), actual = _scopeCase84[0];
expected = true;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('with mixedcase scope should pass for "never [uppercase, lowercase]"', function (t) {
return new Promise(function ($return, $error) {
var _scopeCase85, _scopeCase86, actual, expected;
return Promise.resolve(parsed.mixedcase).then(function ($await_43) {
try {
_scopeCase85 = (0, _scopeCase90.default)($await_43, 'never', ['uppercase', 'lowercase']), _scopeCase86 = (0, _slicedToArray3.default)(_scopeCase85, 1), actual = _scopeCase86[0];
expected = true;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('with uppercase scope should fail for "never [uppercase, lowercase]"', function (t) {
return new Promise(function ($return, $error) {
var _scopeCase87, _scopeCase88, actual, expected;
return Promise.resolve(parsed.uppercase).then(function ($await_44) {
try {
_scopeCase87 = (0, _scopeCase90.default)($await_44, 'never', ['uppercase', 'lowercase']), _scopeCase88 = (0, _slicedToArray3.default)(_scopeCase87, 1), actual = _scopeCase88[0];
expected = false;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
//# sourceMappingURL=scope-case.test.js.map

@@ -15,5 +15,5 @@ 'use strict';

var _subjectCase79 = require('./subject-case');
var _subjectCase91 = require('./subject-case');
var _subjectCase80 = _interopRequireDefault(_subjectCase79);
var _subjectCase92 = _interopRequireDefault(_subjectCase91);

@@ -52,3 +52,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

try {
_subjectCase = (0, _subjectCase80.default)($await_1, 'never', 'lowercase'), _subjectCase2 = (0, _slicedToArray3.default)(_subjectCase, 1), actual = _subjectCase2[0];
_subjectCase = (0, _subjectCase92.default)($await_1, 'never', 'lowercase'), _subjectCase2 = (0, _slicedToArray3.default)(_subjectCase, 1), actual = _subjectCase2[0];

@@ -71,3 +71,3 @@ expected = true;

try {
_subjectCase3 = (0, _subjectCase80.default)($await_2, 'always', 'lowercase'), _subjectCase4 = (0, _slicedToArray3.default)(_subjectCase3, 1), actual = _subjectCase4[0];
_subjectCase3 = (0, _subjectCase92.default)($await_2, 'always', 'lowercase'), _subjectCase4 = (0, _slicedToArray3.default)(_subjectCase3, 1), actual = _subjectCase4[0];

@@ -90,3 +90,3 @@ expected = true;

try {
_subjectCase5 = (0, _subjectCase80.default)($await_3, 'never', 'uppercase'), _subjectCase6 = (0, _slicedToArray3.default)(_subjectCase5, 1), actual = _subjectCase6[0];
_subjectCase5 = (0, _subjectCase92.default)($await_3, 'never', 'uppercase'), _subjectCase6 = (0, _slicedToArray3.default)(_subjectCase5, 1), actual = _subjectCase6[0];

@@ -109,3 +109,3 @@ expected = true;

try {
_subjectCase7 = (0, _subjectCase80.default)($await_4, 'always', 'uppercase'), _subjectCase8 = (0, _slicedToArray3.default)(_subjectCase7, 1), actual = _subjectCase8[0];
_subjectCase7 = (0, _subjectCase92.default)($await_4, 'always', 'uppercase'), _subjectCase8 = (0, _slicedToArray3.default)(_subjectCase7, 1), actual = _subjectCase8[0];

@@ -128,3 +128,3 @@ expected = true;

try {
_subjectCase9 = (0, _subjectCase80.default)($await_5, 'never', 'lowercase'), _subjectCase10 = (0, _slicedToArray3.default)(_subjectCase9, 1), actual = _subjectCase10[0];
_subjectCase9 = (0, _subjectCase92.default)($await_5, 'never', 'lowercase'), _subjectCase10 = (0, _slicedToArray3.default)(_subjectCase9, 1), actual = _subjectCase10[0];

@@ -147,3 +147,3 @@ expected = false;

try {
_subjectCase11 = (0, _subjectCase80.default)($await_6, 'always', 'lowercase'), _subjectCase12 = (0, _slicedToArray3.default)(_subjectCase11, 1), actual = _subjectCase12[0];
_subjectCase11 = (0, _subjectCase92.default)($await_6, 'always', 'lowercase'), _subjectCase12 = (0, _slicedToArray3.default)(_subjectCase11, 1), actual = _subjectCase12[0];

@@ -166,3 +166,3 @@ expected = true;

try {
_subjectCase13 = (0, _subjectCase80.default)($await_7, 'never', 'lowercase'), _subjectCase14 = (0, _slicedToArray3.default)(_subjectCase13, 1), actual = _subjectCase14[0];
_subjectCase13 = (0, _subjectCase92.default)($await_7, 'never', 'lowercase'), _subjectCase14 = (0, _slicedToArray3.default)(_subjectCase13, 1), actual = _subjectCase14[0];

@@ -185,3 +185,3 @@ expected = true;

try {
_subjectCase15 = (0, _subjectCase80.default)($await_8, 'always', 'lowercase'), _subjectCase16 = (0, _slicedToArray3.default)(_subjectCase15, 1), actual = _subjectCase16[0];
_subjectCase15 = (0, _subjectCase92.default)($await_8, 'always', 'lowercase'), _subjectCase16 = (0, _slicedToArray3.default)(_subjectCase15, 1), actual = _subjectCase16[0];

@@ -204,3 +204,3 @@ expected = false;

try {
_subjectCase17 = (0, _subjectCase80.default)($await_9, 'never', 'uppercase'), _subjectCase18 = (0, _slicedToArray3.default)(_subjectCase17, 1), actual = _subjectCase18[0];
_subjectCase17 = (0, _subjectCase92.default)($await_9, 'never', 'uppercase'), _subjectCase18 = (0, _slicedToArray3.default)(_subjectCase17, 1), actual = _subjectCase18[0];

@@ -223,3 +223,3 @@ expected = true;

try {
_subjectCase19 = (0, _subjectCase80.default)($await_10, 'always', 'uppercase'), _subjectCase20 = (0, _slicedToArray3.default)(_subjectCase19, 1), actual = _subjectCase20[0];
_subjectCase19 = (0, _subjectCase92.default)($await_10, 'always', 'uppercase'), _subjectCase20 = (0, _slicedToArray3.default)(_subjectCase19, 1), actual = _subjectCase20[0];

@@ -242,3 +242,3 @@ expected = false;

try {
_subjectCase21 = (0, _subjectCase80.default)($await_11, 'never', 'uppercase'), _subjectCase22 = (0, _slicedToArray3.default)(_subjectCase21, 1), actual = _subjectCase22[0];
_subjectCase21 = (0, _subjectCase92.default)($await_11, 'never', 'uppercase'), _subjectCase22 = (0, _slicedToArray3.default)(_subjectCase21, 1), actual = _subjectCase22[0];

@@ -261,3 +261,3 @@ expected = false;

try {
_subjectCase23 = (0, _subjectCase80.default)($await_12, 'always', 'uppercase'), _subjectCase24 = (0, _slicedToArray3.default)(_subjectCase23, 1), actual = _subjectCase24[0];
_subjectCase23 = (0, _subjectCase92.default)($await_12, 'always', 'uppercase'), _subjectCase24 = (0, _slicedToArray3.default)(_subjectCase23, 1), actual = _subjectCase24[0];

@@ -280,3 +280,3 @@ expected = true;

try {
_subjectCase25 = (0, _subjectCase80.default)($await_13, 'always', 'uppercase'), _subjectCase26 = (0, _slicedToArray3.default)(_subjectCase25, 1), actual = _subjectCase26[0];
_subjectCase25 = (0, _subjectCase92.default)($await_13, 'always', 'uppercase'), _subjectCase26 = (0, _slicedToArray3.default)(_subjectCase25, 1), actual = _subjectCase26[0];

@@ -299,3 +299,3 @@ expected = false;

try {
_subjectCase27 = (0, _subjectCase80.default)($await_14, 'never', 'uppercase'), _subjectCase28 = (0, _slicedToArray3.default)(_subjectCase27, 1), actual = _subjectCase28[0];
_subjectCase27 = (0, _subjectCase92.default)($await_14, 'never', 'uppercase'), _subjectCase28 = (0, _slicedToArray3.default)(_subjectCase27, 1), actual = _subjectCase28[0];

@@ -318,3 +318,3 @@ expected = true;

try {
_subjectCase29 = (0, _subjectCase80.default)($await_15, 'always', 'pascal-case'), _subjectCase30 = (0, _slicedToArray3.default)(_subjectCase29, 1), actual = _subjectCase30[0];
_subjectCase29 = (0, _subjectCase92.default)($await_15, 'always', 'pascal-case'), _subjectCase30 = (0, _slicedToArray3.default)(_subjectCase29, 1), actual = _subjectCase30[0];

@@ -337,3 +337,3 @@ expected = false;

try {
_subjectCase31 = (0, _subjectCase80.default)($await_16, 'always', 'kebab-case'), _subjectCase32 = (0, _slicedToArray3.default)(_subjectCase31, 1), actual = _subjectCase32[0];
_subjectCase31 = (0, _subjectCase92.default)($await_16, 'always', 'kebab-case'), _subjectCase32 = (0, _slicedToArray3.default)(_subjectCase31, 1), actual = _subjectCase32[0];

@@ -356,3 +356,3 @@ expected = false;

try {
_subjectCase33 = (0, _subjectCase80.default)($await_17, 'always', 'snake-case'), _subjectCase34 = (0, _slicedToArray3.default)(_subjectCase33, 1), actual = _subjectCase34[0];
_subjectCase33 = (0, _subjectCase92.default)($await_17, 'always', 'snake-case'), _subjectCase34 = (0, _slicedToArray3.default)(_subjectCase33, 1), actual = _subjectCase34[0];

@@ -375,3 +375,3 @@ expected = false;

try {
_subjectCase35 = (0, _subjectCase80.default)($await_18, 'always', 'camel-case'), _subjectCase36 = (0, _slicedToArray3.default)(_subjectCase35, 1), actual = _subjectCase36[0];
_subjectCase35 = (0, _subjectCase92.default)($await_18, 'always', 'camel-case'), _subjectCase36 = (0, _slicedToArray3.default)(_subjectCase35, 1), actual = _subjectCase36[0];

@@ -394,3 +394,3 @@ expected = true;

try {
_subjectCase37 = (0, _subjectCase80.default)($await_19, 'always', 'uppercase'), _subjectCase38 = (0, _slicedToArray3.default)(_subjectCase37, 1), actual = _subjectCase38[0];
_subjectCase37 = (0, _subjectCase92.default)($await_19, 'always', 'uppercase'), _subjectCase38 = (0, _slicedToArray3.default)(_subjectCase37, 1), actual = _subjectCase38[0];

@@ -413,3 +413,3 @@ expected = false;

try {
_subjectCase39 = (0, _subjectCase80.default)($await_20, 'never', 'uppercase'), _subjectCase40 = (0, _slicedToArray3.default)(_subjectCase39, 1), actual = _subjectCase40[0];
_subjectCase39 = (0, _subjectCase92.default)($await_20, 'never', 'uppercase'), _subjectCase40 = (0, _slicedToArray3.default)(_subjectCase39, 1), actual = _subjectCase40[0];

@@ -432,3 +432,3 @@ expected = true;

try {
_subjectCase41 = (0, _subjectCase80.default)($await_21, 'always', 'pascal-case'), _subjectCase42 = (0, _slicedToArray3.default)(_subjectCase41, 1), actual = _subjectCase42[0];
_subjectCase41 = (0, _subjectCase92.default)($await_21, 'always', 'pascal-case'), _subjectCase42 = (0, _slicedToArray3.default)(_subjectCase41, 1), actual = _subjectCase42[0];

@@ -451,3 +451,3 @@ expected = true;

try {
_subjectCase43 = (0, _subjectCase80.default)($await_22, 'always', 'kebab-case'), _subjectCase44 = (0, _slicedToArray3.default)(_subjectCase43, 1), actual = _subjectCase44[0];
_subjectCase43 = (0, _subjectCase92.default)($await_22, 'always', 'kebab-case'), _subjectCase44 = (0, _slicedToArray3.default)(_subjectCase43, 1), actual = _subjectCase44[0];

@@ -470,3 +470,3 @@ expected = false;

try {
_subjectCase45 = (0, _subjectCase80.default)($await_23, 'always', 'snake-case'), _subjectCase46 = (0, _slicedToArray3.default)(_subjectCase45, 1), actual = _subjectCase46[0];
_subjectCase45 = (0, _subjectCase92.default)($await_23, 'always', 'snake-case'), _subjectCase46 = (0, _slicedToArray3.default)(_subjectCase45, 1), actual = _subjectCase46[0];

@@ -489,3 +489,3 @@ expected = false;

try {
_subjectCase47 = (0, _subjectCase80.default)($await_24, 'always', 'camel-case'), _subjectCase48 = (0, _slicedToArray3.default)(_subjectCase47, 1), actual = _subjectCase48[0];
_subjectCase47 = (0, _subjectCase92.default)($await_24, 'always', 'camel-case'), _subjectCase48 = (0, _slicedToArray3.default)(_subjectCase47, 1), actual = _subjectCase48[0];

@@ -508,3 +508,3 @@ expected = false;

try {
_subjectCase49 = (0, _subjectCase80.default)($await_25, 'always', 'uppercase'), _subjectCase50 = (0, _slicedToArray3.default)(_subjectCase49, 1), actual = _subjectCase50[0];
_subjectCase49 = (0, _subjectCase92.default)($await_25, 'always', 'uppercase'), _subjectCase50 = (0, _slicedToArray3.default)(_subjectCase49, 1), actual = _subjectCase50[0];

@@ -527,3 +527,3 @@ expected = false;

try {
_subjectCase51 = (0, _subjectCase80.default)($await_26, 'never', 'uppercase'), _subjectCase52 = (0, _slicedToArray3.default)(_subjectCase51, 1), actual = _subjectCase52[0];
_subjectCase51 = (0, _subjectCase92.default)($await_26, 'never', 'uppercase'), _subjectCase52 = (0, _slicedToArray3.default)(_subjectCase51, 1), actual = _subjectCase52[0];

@@ -546,3 +546,3 @@ expected = true;

try {
_subjectCase53 = (0, _subjectCase80.default)($await_27, 'always', 'pascal-case'), _subjectCase54 = (0, _slicedToArray3.default)(_subjectCase53, 1), actual = _subjectCase54[0];
_subjectCase53 = (0, _subjectCase92.default)($await_27, 'always', 'pascal-case'), _subjectCase54 = (0, _slicedToArray3.default)(_subjectCase53, 1), actual = _subjectCase54[0];

@@ -565,3 +565,3 @@ expected = false;

try {
_subjectCase55 = (0, _subjectCase80.default)($await_28, 'always', 'kebab-case'), _subjectCase56 = (0, _slicedToArray3.default)(_subjectCase55, 1), actual = _subjectCase56[0];
_subjectCase55 = (0, _subjectCase92.default)($await_28, 'always', 'kebab-case'), _subjectCase56 = (0, _slicedToArray3.default)(_subjectCase55, 1), actual = _subjectCase56[0];

@@ -584,3 +584,3 @@ expected = false;

try {
_subjectCase57 = (0, _subjectCase80.default)($await_29, 'always', 'snake-case'), _subjectCase58 = (0, _slicedToArray3.default)(_subjectCase57, 1), actual = _subjectCase58[0];
_subjectCase57 = (0, _subjectCase92.default)($await_29, 'always', 'snake-case'), _subjectCase58 = (0, _slicedToArray3.default)(_subjectCase57, 1), actual = _subjectCase58[0];

@@ -603,3 +603,3 @@ expected = true;

try {
_subjectCase59 = (0, _subjectCase80.default)($await_30, 'always', 'camel-case'), _subjectCase60 = (0, _slicedToArray3.default)(_subjectCase59, 1), actual = _subjectCase60[0];
_subjectCase59 = (0, _subjectCase92.default)($await_30, 'always', 'camel-case'), _subjectCase60 = (0, _slicedToArray3.default)(_subjectCase59, 1), actual = _subjectCase60[0];

@@ -622,3 +622,3 @@ expected = false;

try {
_subjectCase61 = (0, _subjectCase80.default)($await_31, 'always', 'uppercase'), _subjectCase62 = (0, _slicedToArray3.default)(_subjectCase61, 1), actual = _subjectCase62[0];
_subjectCase61 = (0, _subjectCase92.default)($await_31, 'always', 'uppercase'), _subjectCase62 = (0, _slicedToArray3.default)(_subjectCase61, 1), actual = _subjectCase62[0];

@@ -641,3 +641,3 @@ expected = false;

try {
_subjectCase63 = (0, _subjectCase80.default)($await_32, 'never', 'uppercase'), _subjectCase64 = (0, _slicedToArray3.default)(_subjectCase63, 1), actual = _subjectCase64[0];
_subjectCase63 = (0, _subjectCase92.default)($await_32, 'never', 'uppercase'), _subjectCase64 = (0, _slicedToArray3.default)(_subjectCase63, 1), actual = _subjectCase64[0];

@@ -660,3 +660,3 @@ expected = true;

try {
_subjectCase65 = (0, _subjectCase80.default)($await_33, 'always', 'pascal-case'), _subjectCase66 = (0, _slicedToArray3.default)(_subjectCase65, 1), actual = _subjectCase66[0];
_subjectCase65 = (0, _subjectCase92.default)($await_33, 'always', 'pascal-case'), _subjectCase66 = (0, _slicedToArray3.default)(_subjectCase65, 1), actual = _subjectCase66[0];

@@ -679,3 +679,3 @@ expected = false;

try {
_subjectCase67 = (0, _subjectCase80.default)($await_34, 'always', 'kebab-case'), _subjectCase68 = (0, _slicedToArray3.default)(_subjectCase67, 1), actual = _subjectCase68[0];
_subjectCase67 = (0, _subjectCase92.default)($await_34, 'always', 'kebab-case'), _subjectCase68 = (0, _slicedToArray3.default)(_subjectCase67, 1), actual = _subjectCase68[0];

@@ -698,3 +698,3 @@ expected = false;

try {
_subjectCase69 = (0, _subjectCase80.default)($await_35, 'always', 'snake-case'), _subjectCase70 = (0, _slicedToArray3.default)(_subjectCase69, 1), actual = _subjectCase70[0];
_subjectCase69 = (0, _subjectCase92.default)($await_35, 'always', 'snake-case'), _subjectCase70 = (0, _slicedToArray3.default)(_subjectCase69, 1), actual = _subjectCase70[0];

@@ -717,3 +717,3 @@ expected = false;

try {
_subjectCase71 = (0, _subjectCase80.default)($await_36, 'always', 'camel-case'), _subjectCase72 = (0, _slicedToArray3.default)(_subjectCase71, 1), actual = _subjectCase72[0];
_subjectCase71 = (0, _subjectCase92.default)($await_36, 'always', 'camel-case'), _subjectCase72 = (0, _slicedToArray3.default)(_subjectCase71, 1), actual = _subjectCase72[0];

@@ -736,3 +736,3 @@ expected = false;

try {
_subjectCase73 = (0, _subjectCase80.default)($await_37, 'always', 'start-case'), _subjectCase74 = (0, _slicedToArray3.default)(_subjectCase73, 1), actual = _subjectCase74[0];
_subjectCase73 = (0, _subjectCase92.default)($await_37, 'always', 'start-case'), _subjectCase74 = (0, _slicedToArray3.default)(_subjectCase73, 1), actual = _subjectCase74[0];

@@ -755,3 +755,3 @@ expected = true;

try {
_subjectCase75 = (0, _subjectCase80.default)($await_38, 'always', 'lower-case'), _subjectCase76 = (0, _slicedToArray3.default)(_subjectCase75, 2), message = _subjectCase76[1];
_subjectCase75 = (0, _subjectCase92.default)($await_38, 'always', 'lower-case'), _subjectCase76 = (0, _slicedToArray3.default)(_subjectCase75, 2), message = _subjectCase76[1];

@@ -773,3 +773,3 @@ t.true(message.indexOf('must be lower-case') > -1);

try {
_subjectCase77 = (0, _subjectCase80.default)($await_39, 'never', 'upper-case'), _subjectCase78 = (0, _slicedToArray3.default)(_subjectCase77, 2), message = _subjectCase78[1];
_subjectCase77 = (0, _subjectCase92.default)($await_39, 'never', 'upper-case'), _subjectCase78 = (0, _slicedToArray3.default)(_subjectCase77, 2), message = _subjectCase78[1];

@@ -784,2 +784,110 @@ t.true(message.indexOf('must not be upper-case') > -1);

});
(0, _ava2.default)('with uppercase scope should succeed for "always [uppercase, lowercase]"', function (t) {
return new Promise(function ($return, $error) {
var _subjectCase79, _subjectCase80, actual, expected;
return Promise.resolve(parsed.uppercase).then(function ($await_40) {
try {
_subjectCase79 = (0, _subjectCase92.default)($await_40, 'always', ['uppercase', 'lowercase']), _subjectCase80 = (0, _slicedToArray3.default)(_subjectCase79, 1), actual = _subjectCase80[0];
expected = true;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('with lowercase subject should succeed for "always [uppercase, lowercase]"', function (t) {
return new Promise(function ($return, $error) {
var _subjectCase81, _subjectCase82, actual, expected;
return Promise.resolve(parsed.lowercase).then(function ($await_41) {
try {
_subjectCase81 = (0, _subjectCase92.default)($await_41, 'always', ['uppercase', 'lowercase']), _subjectCase82 = (0, _slicedToArray3.default)(_subjectCase81, 1), actual = _subjectCase82[0];
expected = true;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('with mixedcase subject should fail for "always [uppercase, lowercase]"', function (t) {
return new Promise(function ($return, $error) {
var _subjectCase83, _subjectCase84, actual, expected;
return Promise.resolve(parsed.mixedcase).then(function ($await_42) {
try {
_subjectCase83 = (0, _subjectCase92.default)($await_42, 'always', ['uppercase', 'lowercase']), _subjectCase84 = (0, _slicedToArray3.default)(_subjectCase83, 1), actual = _subjectCase84[0];
expected = false;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('with mixedcase subject should pass for "always [uppercase, lowercase, camel-case]"', function (t) {
return new Promise(function ($return, $error) {
var _subjectCase85, _subjectCase86, actual, expected;
return Promise.resolve(parsed.mixedcase).then(function ($await_43) {
try {
_subjectCase85 = (0, _subjectCase92.default)($await_43, 'always', ['uppercase', 'lowercase', 'camel-case']), _subjectCase86 = (0, _slicedToArray3.default)(_subjectCase85, 1), actual = _subjectCase86[0];
expected = true;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('with mixedcase scope should pass for "never [uppercase, lowercase]"', function (t) {
return new Promise(function ($return, $error) {
var _subjectCase87, _subjectCase88, actual, expected;
return Promise.resolve(parsed.mixedcase).then(function ($await_44) {
try {
_subjectCase87 = (0, _subjectCase92.default)($await_44, 'never', ['uppercase', 'lowercase']), _subjectCase88 = (0, _slicedToArray3.default)(_subjectCase87, 1), actual = _subjectCase88[0];
expected = true;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('with uppercase scope should fail for "never [uppercase, lowercase]"', function (t) {
return new Promise(function ($return, $error) {
var _subjectCase89, _subjectCase90, actual, expected;
return Promise.resolve(parsed.uppercase).then(function ($await_45) {
try {
_subjectCase89 = (0, _subjectCase92.default)($await_45, 'never', ['uppercase', 'lowercase']), _subjectCase90 = (0, _slicedToArray3.default)(_subjectCase89, 1), actual = _subjectCase90[0];
expected = false;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
//# sourceMappingURL=subject-case.test.js.map

@@ -19,2 +19,6 @@ 'use strict';

var negated = function negated(when) {
return when === 'never';
};
exports.default = function (parsed, when, value) {

@@ -28,6 +32,22 @@ var type = parsed.type;

var negated = when === 'never';
var checks = (Array.isArray(value) ? value : [value]).map(function (check) {
if (typeof check === 'string') {
return {
when: 'always',
case: check
};
}
return check;
});
var result = ensure.case(type, value);
return [negated ? !result : result, (0, _message2.default)([`type must`, negated ? `not` : null, `be ${value}`])];
var result = checks.some(function (check) {
var r = ensure.case(type, check.case);
return negated(check.when) ? !r : r;
});
var list = checks.map(function (c) {
return c.case;
}).join(', ');
return [negated(when) ? !result : result, (0, _message2.default)([`type must`, negated(when) ? `not` : null, `be ${list}`])];
};

@@ -34,0 +54,0 @@

@@ -15,5 +15,5 @@ 'use strict';

var _typeCase81 = require('./type-case');
var _typeCase93 = require('./type-case');
var _typeCase82 = _interopRequireDefault(_typeCase81);
var _typeCase94 = _interopRequireDefault(_typeCase93);

@@ -55,3 +55,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

try {
_typeCase = (0, _typeCase82.default)($await_1, 'never', 'lowercase'), _typeCase2 = (0, _slicedToArray3.default)(_typeCase, 1), actual = _typeCase2[0];
_typeCase = (0, _typeCase94.default)($await_1, 'never', 'lowercase'), _typeCase2 = (0, _slicedToArray3.default)(_typeCase, 1), actual = _typeCase2[0];

@@ -74,3 +74,3 @@ expected = true;

try {
_typeCase3 = (0, _typeCase82.default)($await_2, 'always', 'lowercase'), _typeCase4 = (0, _slicedToArray3.default)(_typeCase3, 1), actual = _typeCase4[0];
_typeCase3 = (0, _typeCase94.default)($await_2, 'always', 'lowercase'), _typeCase4 = (0, _slicedToArray3.default)(_typeCase3, 1), actual = _typeCase4[0];

@@ -93,3 +93,3 @@ expected = true;

try {
_typeCase5 = (0, _typeCase82.default)($await_3, 'never', 'uppercase'), _typeCase6 = (0, _slicedToArray3.default)(_typeCase5, 1), actual = _typeCase6[0];
_typeCase5 = (0, _typeCase94.default)($await_3, 'never', 'uppercase'), _typeCase6 = (0, _slicedToArray3.default)(_typeCase5, 1), actual = _typeCase6[0];

@@ -112,3 +112,3 @@ expected = true;

try {
_typeCase7 = (0, _typeCase82.default)($await_4, 'always', 'uppercase'), _typeCase8 = (0, _slicedToArray3.default)(_typeCase7, 1), actual = _typeCase8[0];
_typeCase7 = (0, _typeCase94.default)($await_4, 'always', 'uppercase'), _typeCase8 = (0, _slicedToArray3.default)(_typeCase7, 1), actual = _typeCase8[0];

@@ -131,3 +131,3 @@ expected = true;

try {
_typeCase9 = (0, _typeCase82.default)($await_5, 'never', 'lowercase'), _typeCase10 = (0, _slicedToArray3.default)(_typeCase9, 1), actual = _typeCase10[0];
_typeCase9 = (0, _typeCase94.default)($await_5, 'never', 'lowercase'), _typeCase10 = (0, _slicedToArray3.default)(_typeCase9, 1), actual = _typeCase10[0];

@@ -150,3 +150,3 @@ expected = false;

try {
_typeCase11 = (0, _typeCase82.default)($await_6, 'always', 'lowercase'), _typeCase12 = (0, _slicedToArray3.default)(_typeCase11, 1), actual = _typeCase12[0];
_typeCase11 = (0, _typeCase94.default)($await_6, 'always', 'lowercase'), _typeCase12 = (0, _slicedToArray3.default)(_typeCase11, 1), actual = _typeCase12[0];

@@ -169,3 +169,3 @@ expected = true;

try {
_typeCase13 = (0, _typeCase82.default)($await_7, 'never', 'lowercase'), _typeCase14 = (0, _slicedToArray3.default)(_typeCase13, 1), actual = _typeCase14[0];
_typeCase13 = (0, _typeCase94.default)($await_7, 'never', 'lowercase'), _typeCase14 = (0, _slicedToArray3.default)(_typeCase13, 1), actual = _typeCase14[0];

@@ -188,3 +188,3 @@ expected = true;

try {
_typeCase15 = (0, _typeCase82.default)($await_8, 'always', 'lowercase'), _typeCase16 = (0, _slicedToArray3.default)(_typeCase15, 1), actual = _typeCase16[0];
_typeCase15 = (0, _typeCase94.default)($await_8, 'always', 'lowercase'), _typeCase16 = (0, _slicedToArray3.default)(_typeCase15, 1), actual = _typeCase16[0];

@@ -207,3 +207,3 @@ expected = false;

try {
_typeCase17 = (0, _typeCase82.default)($await_9, 'never', 'uppercase'), _typeCase18 = (0, _slicedToArray3.default)(_typeCase17, 1), actual = _typeCase18[0];
_typeCase17 = (0, _typeCase94.default)($await_9, 'never', 'uppercase'), _typeCase18 = (0, _slicedToArray3.default)(_typeCase17, 1), actual = _typeCase18[0];

@@ -226,3 +226,3 @@ expected = true;

try {
_typeCase19 = (0, _typeCase82.default)($await_10, 'always', 'uppercase'), _typeCase20 = (0, _slicedToArray3.default)(_typeCase19, 1), actual = _typeCase20[0];
_typeCase19 = (0, _typeCase94.default)($await_10, 'always', 'uppercase'), _typeCase20 = (0, _slicedToArray3.default)(_typeCase19, 1), actual = _typeCase20[0];

@@ -245,3 +245,3 @@ expected = false;

try {
_typeCase21 = (0, _typeCase82.default)($await_11, 'never', 'uppercase'), _typeCase22 = (0, _slicedToArray3.default)(_typeCase21, 1), actual = _typeCase22[0];
_typeCase21 = (0, _typeCase94.default)($await_11, 'never', 'uppercase'), _typeCase22 = (0, _slicedToArray3.default)(_typeCase21, 1), actual = _typeCase22[0];

@@ -264,3 +264,3 @@ expected = false;

try {
_typeCase23 = (0, _typeCase82.default)($await_12, 'always', 'uppercase'), _typeCase24 = (0, _slicedToArray3.default)(_typeCase23, 1), actual = _typeCase24[0];
_typeCase23 = (0, _typeCase94.default)($await_12, 'always', 'uppercase'), _typeCase24 = (0, _slicedToArray3.default)(_typeCase23, 1), actual = _typeCase24[0];

@@ -283,3 +283,3 @@ expected = true;

try {
_typeCase25 = (0, _typeCase82.default)($await_13, 'always', 'uppercase'), _typeCase26 = (0, _slicedToArray3.default)(_typeCase25, 1), actual = _typeCase26[0];
_typeCase25 = (0, _typeCase94.default)($await_13, 'always', 'uppercase'), _typeCase26 = (0, _slicedToArray3.default)(_typeCase25, 1), actual = _typeCase26[0];

@@ -302,3 +302,3 @@ expected = false;

try {
_typeCase27 = (0, _typeCase82.default)($await_14, 'never', 'uppercase'), _typeCase28 = (0, _slicedToArray3.default)(_typeCase27, 1), actual = _typeCase28[0];
_typeCase27 = (0, _typeCase94.default)($await_14, 'never', 'uppercase'), _typeCase28 = (0, _slicedToArray3.default)(_typeCase27, 1), actual = _typeCase28[0];

@@ -321,3 +321,3 @@ expected = true;

try {
_typeCase29 = (0, _typeCase82.default)($await_15, 'always', 'pascal-case'), _typeCase30 = (0, _slicedToArray3.default)(_typeCase29, 1), actual = _typeCase30[0];
_typeCase29 = (0, _typeCase94.default)($await_15, 'always', 'pascal-case'), _typeCase30 = (0, _slicedToArray3.default)(_typeCase29, 1), actual = _typeCase30[0];

@@ -340,3 +340,3 @@ expected = false;

try {
_typeCase31 = (0, _typeCase82.default)($await_16, 'always', 'kebab-case'), _typeCase32 = (0, _slicedToArray3.default)(_typeCase31, 1), actual = _typeCase32[0];
_typeCase31 = (0, _typeCase94.default)($await_16, 'always', 'kebab-case'), _typeCase32 = (0, _slicedToArray3.default)(_typeCase31, 1), actual = _typeCase32[0];

@@ -359,3 +359,3 @@ expected = false;

try {
_typeCase33 = (0, _typeCase82.default)($await_17, 'always', 'snake-case'), _typeCase34 = (0, _slicedToArray3.default)(_typeCase33, 1), actual = _typeCase34[0];
_typeCase33 = (0, _typeCase94.default)($await_17, 'always', 'snake-case'), _typeCase34 = (0, _slicedToArray3.default)(_typeCase33, 1), actual = _typeCase34[0];

@@ -378,3 +378,3 @@ expected = false;

try {
_typeCase35 = (0, _typeCase82.default)($await_18, 'always', 'start-case'), _typeCase36 = (0, _slicedToArray3.default)(_typeCase35, 1), actual = _typeCase36[0];
_typeCase35 = (0, _typeCase94.default)($await_18, 'always', 'start-case'), _typeCase36 = (0, _slicedToArray3.default)(_typeCase35, 1), actual = _typeCase36[0];

@@ -397,3 +397,3 @@ expected = false;

try {
_typeCase37 = (0, _typeCase82.default)($await_19, 'always', 'camel-case'), _typeCase38 = (0, _slicedToArray3.default)(_typeCase37, 1), actual = _typeCase38[0];
_typeCase37 = (0, _typeCase94.default)($await_19, 'always', 'camel-case'), _typeCase38 = (0, _slicedToArray3.default)(_typeCase37, 1), actual = _typeCase38[0];

@@ -416,3 +416,3 @@ expected = true;

try {
_typeCase39 = (0, _typeCase82.default)($await_20, 'always', 'uppercase'), _typeCase40 = (0, _slicedToArray3.default)(_typeCase39, 1), actual = _typeCase40[0];
_typeCase39 = (0, _typeCase94.default)($await_20, 'always', 'uppercase'), _typeCase40 = (0, _slicedToArray3.default)(_typeCase39, 1), actual = _typeCase40[0];

@@ -435,3 +435,3 @@ expected = false;

try {
_typeCase41 = (0, _typeCase82.default)($await_21, 'never', 'uppercase'), _typeCase42 = (0, _slicedToArray3.default)(_typeCase41, 1), actual = _typeCase42[0];
_typeCase41 = (0, _typeCase94.default)($await_21, 'never', 'uppercase'), _typeCase42 = (0, _slicedToArray3.default)(_typeCase41, 1), actual = _typeCase42[0];

@@ -454,3 +454,3 @@ expected = true;

try {
_typeCase43 = (0, _typeCase82.default)($await_22, 'always', 'camel-case'), _typeCase44 = (0, _slicedToArray3.default)(_typeCase43, 1), actual = _typeCase44[0];
_typeCase43 = (0, _typeCase94.default)($await_22, 'always', 'camel-case'), _typeCase44 = (0, _slicedToArray3.default)(_typeCase43, 1), actual = _typeCase44[0];

@@ -473,3 +473,3 @@ expected = false;

try {
_typeCase45 = (0, _typeCase82.default)($await_23, 'always', 'kebab-case'), _typeCase46 = (0, _slicedToArray3.default)(_typeCase45, 1), actual = _typeCase46[0];
_typeCase45 = (0, _typeCase94.default)($await_23, 'always', 'kebab-case'), _typeCase46 = (0, _slicedToArray3.default)(_typeCase45, 1), actual = _typeCase46[0];

@@ -492,3 +492,3 @@ expected = false;

try {
_typeCase47 = (0, _typeCase82.default)($await_24, 'always', 'snake-case'), _typeCase48 = (0, _slicedToArray3.default)(_typeCase47, 1), actual = _typeCase48[0];
_typeCase47 = (0, _typeCase94.default)($await_24, 'always', 'snake-case'), _typeCase48 = (0, _slicedToArray3.default)(_typeCase47, 1), actual = _typeCase48[0];

@@ -511,3 +511,3 @@ expected = false;

try {
_typeCase49 = (0, _typeCase82.default)($await_25, 'always', 'start-case'), _typeCase50 = (0, _slicedToArray3.default)(_typeCase49, 1), actual = _typeCase50[0];
_typeCase49 = (0, _typeCase94.default)($await_25, 'always', 'start-case'), _typeCase50 = (0, _slicedToArray3.default)(_typeCase49, 1), actual = _typeCase50[0];

@@ -530,3 +530,3 @@ expected = false;

try {
_typeCase51 = (0, _typeCase82.default)($await_26, 'always', 'pascal-case'), _typeCase52 = (0, _slicedToArray3.default)(_typeCase51, 1), actual = _typeCase52[0];
_typeCase51 = (0, _typeCase94.default)($await_26, 'always', 'pascal-case'), _typeCase52 = (0, _slicedToArray3.default)(_typeCase51, 1), actual = _typeCase52[0];

@@ -549,3 +549,3 @@ expected = true;

try {
_typeCase53 = (0, _typeCase82.default)($await_27, 'always', 'uppercase'), _typeCase54 = (0, _slicedToArray3.default)(_typeCase53, 1), actual = _typeCase54[0];
_typeCase53 = (0, _typeCase94.default)($await_27, 'always', 'uppercase'), _typeCase54 = (0, _slicedToArray3.default)(_typeCase53, 1), actual = _typeCase54[0];

@@ -568,3 +568,3 @@ expected = false;

try {
_typeCase55 = (0, _typeCase82.default)($await_28, 'never', 'uppercase'), _typeCase56 = (0, _slicedToArray3.default)(_typeCase55, 1), actual = _typeCase56[0];
_typeCase55 = (0, _typeCase94.default)($await_28, 'never', 'uppercase'), _typeCase56 = (0, _slicedToArray3.default)(_typeCase55, 1), actual = _typeCase56[0];

@@ -587,3 +587,3 @@ expected = true;

try {
_typeCase57 = (0, _typeCase82.default)($await_29, 'always', 'camel-case'), _typeCase58 = (0, _slicedToArray3.default)(_typeCase57, 1), actual = _typeCase58[0];
_typeCase57 = (0, _typeCase94.default)($await_29, 'always', 'camel-case'), _typeCase58 = (0, _slicedToArray3.default)(_typeCase57, 1), actual = _typeCase58[0];

@@ -606,3 +606,3 @@ expected = false;

try {
_typeCase59 = (0, _typeCase82.default)($await_30, 'always', 'kebab-case'), _typeCase60 = (0, _slicedToArray3.default)(_typeCase59, 1), actual = _typeCase60[0];
_typeCase59 = (0, _typeCase94.default)($await_30, 'always', 'kebab-case'), _typeCase60 = (0, _slicedToArray3.default)(_typeCase59, 1), actual = _typeCase60[0];

@@ -625,3 +625,3 @@ expected = false;

try {
_typeCase61 = (0, _typeCase82.default)($await_31, 'always', 'snake-case'), _typeCase62 = (0, _slicedToArray3.default)(_typeCase61, 1), actual = _typeCase62[0];
_typeCase61 = (0, _typeCase94.default)($await_31, 'always', 'snake-case'), _typeCase62 = (0, _slicedToArray3.default)(_typeCase61, 1), actual = _typeCase62[0];

@@ -644,3 +644,3 @@ expected = true;

try {
_typeCase63 = (0, _typeCase82.default)($await_32, 'always', 'pascal-case'), _typeCase64 = (0, _slicedToArray3.default)(_typeCase63, 1), actual = _typeCase64[0];
_typeCase63 = (0, _typeCase94.default)($await_32, 'always', 'pascal-case'), _typeCase64 = (0, _slicedToArray3.default)(_typeCase63, 1), actual = _typeCase64[0];

@@ -663,3 +663,3 @@ expected = false;

try {
_typeCase65 = (0, _typeCase82.default)($await_33, 'always', 'start-case'), _typeCase66 = (0, _slicedToArray3.default)(_typeCase65, 1), actual = _typeCase66[0];
_typeCase65 = (0, _typeCase94.default)($await_33, 'always', 'start-case'), _typeCase66 = (0, _slicedToArray3.default)(_typeCase65, 1), actual = _typeCase66[0];

@@ -682,3 +682,3 @@ expected = false;

try {
_typeCase67 = (0, _typeCase82.default)($await_34, 'always', 'uppercase'), _typeCase68 = (0, _slicedToArray3.default)(_typeCase67, 1), actual = _typeCase68[0];
_typeCase67 = (0, _typeCase94.default)($await_34, 'always', 'uppercase'), _typeCase68 = (0, _slicedToArray3.default)(_typeCase67, 1), actual = _typeCase68[0];

@@ -701,3 +701,3 @@ expected = false;

try {
_typeCase69 = (0, _typeCase82.default)($await_35, 'never', 'uppercase'), _typeCase70 = (0, _slicedToArray3.default)(_typeCase69, 1), actual = _typeCase70[0];
_typeCase69 = (0, _typeCase94.default)($await_35, 'never', 'uppercase'), _typeCase70 = (0, _slicedToArray3.default)(_typeCase69, 1), actual = _typeCase70[0];

@@ -720,3 +720,3 @@ expected = true;

try {
_typeCase71 = (0, _typeCase82.default)($await_36, 'always', 'camel-case'), _typeCase72 = (0, _slicedToArray3.default)(_typeCase71, 1), actual = _typeCase72[0];
_typeCase71 = (0, _typeCase94.default)($await_36, 'always', 'camel-case'), _typeCase72 = (0, _slicedToArray3.default)(_typeCase71, 1), actual = _typeCase72[0];

@@ -739,3 +739,3 @@ expected = false;

try {
_typeCase73 = (0, _typeCase82.default)($await_37, 'always', 'kebab-case'), _typeCase74 = (0, _slicedToArray3.default)(_typeCase73, 1), actual = _typeCase74[0];
_typeCase73 = (0, _typeCase94.default)($await_37, 'always', 'kebab-case'), _typeCase74 = (0, _slicedToArray3.default)(_typeCase73, 1), actual = _typeCase74[0];

@@ -758,3 +758,3 @@ expected = false;

try {
_typeCase75 = (0, _typeCase82.default)($await_38, 'always', 'snake-case'), _typeCase76 = (0, _slicedToArray3.default)(_typeCase75, 1), actual = _typeCase76[0];
_typeCase75 = (0, _typeCase94.default)($await_38, 'always', 'snake-case'), _typeCase76 = (0, _slicedToArray3.default)(_typeCase75, 1), actual = _typeCase76[0];

@@ -777,3 +777,3 @@ expected = false;

try {
_typeCase77 = (0, _typeCase82.default)($await_39, 'always', 'pascal-case'), _typeCase78 = (0, _slicedToArray3.default)(_typeCase77, 1), actual = _typeCase78[0];
_typeCase77 = (0, _typeCase94.default)($await_39, 'always', 'pascal-case'), _typeCase78 = (0, _slicedToArray3.default)(_typeCase77, 1), actual = _typeCase78[0];

@@ -796,3 +796,3 @@ expected = false;

try {
_typeCase79 = (0, _typeCase82.default)($await_40, 'always', 'start-case'), _typeCase80 = (0, _slicedToArray3.default)(_typeCase79, 1), actual = _typeCase80[0];
_typeCase79 = (0, _typeCase94.default)($await_40, 'always', 'start-case'), _typeCase80 = (0, _slicedToArray3.default)(_typeCase79, 1), actual = _typeCase80[0];

@@ -808,2 +808,110 @@ expected = true;

});
(0, _ava2.default)('with uppercase scope should succeed for "always [uppercase, lowercase]"', function (t) {
return new Promise(function ($return, $error) {
var _typeCase81, _typeCase82, actual, expected;
return Promise.resolve(parsed.uppercase).then(function ($await_41) {
try {
_typeCase81 = (0, _typeCase94.default)($await_41, 'always', ['uppercase', 'lowercase']), _typeCase82 = (0, _slicedToArray3.default)(_typeCase81, 1), actual = _typeCase82[0];
expected = true;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('with lowercase subject should succeed for "always [uppercase, lowercase]"', function (t) {
return new Promise(function ($return, $error) {
var _typeCase83, _typeCase84, actual, expected;
return Promise.resolve(parsed.lowercase).then(function ($await_42) {
try {
_typeCase83 = (0, _typeCase94.default)($await_42, 'always', ['uppercase', 'lowercase']), _typeCase84 = (0, _slicedToArray3.default)(_typeCase83, 1), actual = _typeCase84[0];
expected = true;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('with mixedcase subject should fail for "always [uppercase, lowercase]"', function (t) {
return new Promise(function ($return, $error) {
var _typeCase85, _typeCase86, actual, expected;
return Promise.resolve(parsed.mixedcase).then(function ($await_43) {
try {
_typeCase85 = (0, _typeCase94.default)($await_43, 'always', ['uppercase', 'lowercase']), _typeCase86 = (0, _slicedToArray3.default)(_typeCase85, 1), actual = _typeCase86[0];
expected = false;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('with mixedcase subject should pass for "always [uppercase, lowercase, camel-case]"', function (t) {
return new Promise(function ($return, $error) {
var _typeCase87, _typeCase88, actual, expected;
return Promise.resolve(parsed.mixedcase).then(function ($await_44) {
try {
_typeCase87 = (0, _typeCase94.default)($await_44, 'always', ['uppercase', 'lowercase', 'camel-case']), _typeCase88 = (0, _slicedToArray3.default)(_typeCase87, 1), actual = _typeCase88[0];
expected = true;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('with mixedcase scope should pass for "never [uppercase, lowercase]"', function (t) {
return new Promise(function ($return, $error) {
var _typeCase89, _typeCase90, actual, expected;
return Promise.resolve(parsed.mixedcase).then(function ($await_45) {
try {
_typeCase89 = (0, _typeCase94.default)($await_45, 'never', ['uppercase', 'lowercase']), _typeCase90 = (0, _slicedToArray3.default)(_typeCase89, 1), actual = _typeCase90[0];
expected = true;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('with uppercase scope should fail for "never [uppercase, lowercase]"', function (t) {
return new Promise(function ($return, $error) {
var _typeCase91, _typeCase92, actual, expected;
return Promise.resolve(parsed.uppercase).then(function ($await_46) {
try {
_typeCase91 = (0, _typeCase94.default)($await_46, 'never', ['uppercase', 'lowercase']), _typeCase92 = (0, _slicedToArray3.default)(_typeCase91, 1), actual = _typeCase92[0];
expected = false;
t.is(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
//# sourceMappingURL=type-case.test.js.map
{
"name": "@commitlint/rules",
"version": "6.1.3",
"version": "6.2.0",
"description": "Lint your commit messages",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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