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

@commitlint/ensure

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commitlint/ensure - npm Package Compare versions

Comparing version 6.1.3 to 7.0.0

13

lib/case.js

@@ -32,9 +32,8 @@ 'use strict';

function ensureCase() {
var raw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'lowercase';
function ensureCase(raw = '', target = 'lowercase') {
// We delete any content together with quotes because he can contains proper names (example `refactor: `Eslint` configuration`).
// We need trim string because content with quotes can be at the beginning or end of a line
const input = String(raw).replace(/`.*?`|".*?"|'.*?'/g, '').trim();
const transformed = toCase(input, target);
var input = String(raw);
var transformed = toCase(input, target);
if (transformed === '') {

@@ -65,3 +64,3 @@ return true;

{
var word = input.split(' ')[0];
const word = input.split(' ')[0];
return `${toCase(word.charAt(0), 'upper-case')}${toCase(word.slice(1), 'lower-case')}${input.slice(word.length)}`;

@@ -68,0 +67,0 @@ }

@@ -13,34 +13,34 @@ 'use strict';

(0, _ava2.default)('true for no params', function (t) {
var actual = (0, _case2.default)();
(0, _ava2.default)('true for no params', t => {
const actual = (0, _case2.default)();
t.is(actual, true);
});
(0, _ava2.default)('true for empty', function (t) {
var actual = (0, _case2.default)('');
(0, _ava2.default)('true for empty', t => {
const actual = (0, _case2.default)('');
t.is(actual, true);
});
(0, _ava2.default)('true for lowercase', function (t) {
var actual = (0, _case2.default)('a');
(0, _ava2.default)('true for lowercase', t => {
const actual = (0, _case2.default)('a');
t.is(actual, true);
});
(0, _ava2.default)('false for uppercase', function (t) {
var actual = (0, _case2.default)('A');
(0, _ava2.default)('false for uppercase', t => {
const actual = (0, _case2.default)('A');
t.is(actual, false);
});
(0, _ava2.default)('true for lowercase on lowercase', function (t) {
var actual = (0, _case2.default)('a', 'lowercase');
(0, _ava2.default)('true for lowercase on lowercase', t => {
const actual = (0, _case2.default)('a', 'lowercase');
t.is(actual, true);
});
(0, _ava2.default)('false for uppercase on lowercase', function (t) {
var actual = (0, _case2.default)('A', 'lowercase');
(0, _ava2.default)('false for uppercase on lowercase', t => {
const actual = (0, _case2.default)('A', 'lowercase');
t.is(actual, false);
});
(0, _ava2.default)('true for * on lowercase', function (t) {
var actual = (0, _case2.default)('*', 'lowercase');
(0, _ava2.default)('true for * on lowercase', t => {
const actual = (0, _case2.default)('*', 'lowercase');
console.log({ actual });

@@ -50,79 +50,214 @@ t.is(actual, true);

(0, _ava2.default)('true for uppercase on uppercase', function (t) {
var actual = (0, _case2.default)('A', 'uppercase');
(0, _ava2.default)('true for uppercase on uppercase', t => {
const actual = (0, _case2.default)('A', 'uppercase');
t.is(actual, true);
});
(0, _ava2.default)('false for lowercase on uppercase', function (t) {
var actual = (0, _case2.default)('a', 'uppercase');
(0, _ava2.default)('false for lowercase on uppercase', t => {
const actual = (0, _case2.default)('a', 'uppercase');
t.is(actual, false);
});
(0, _ava2.default)('true for * on uppercase', function (t) {
var actual = (0, _case2.default)('*', 'uppercase');
(0, _ava2.default)('true for * on uppercase', t => {
const actual = (0, _case2.default)('*', 'uppercase');
t.is(actual, true);
});
(0, _ava2.default)('true for sentencecase on sentencecase', function (t) {
var actual = (0, _case2.default)('Sentence case', 'sentence-case');
(0, _ava2.default)('true for sentencecase on sentencecase', t => {
const actual = (0, _case2.default)('Sentence case', 'sentence-case');
t.is(actual, true);
});
(0, _ava2.default)('false for lowercase on sentencecase', function (t) {
(0, _ava2.default)('false for lowercase on sentencecase', t => {
t.is((0, _case2.default)('sentence case', 'sentence-case'), false);
});
(0, _ava2.default)('false for UPPERCASE on sentencecase', function (t) {
(0, _ava2.default)('false for UPPERCASE on sentencecase', t => {
t.is((0, _case2.default)('UPPERCASE', 'sentence-case'), false);
});
(0, _ava2.default)('true for Start Case on sentencecase', function (t) {
(0, _ava2.default)('true for Start Case on sentencecase', t => {
t.is((0, _case2.default)('Start Case', 'sentence-case'), true);
});
(0, _ava2.default)('false for PascalCase on sentencecase', function (t) {
(0, _ava2.default)('false for PascalCase on sentencecase', t => {
t.is((0, _case2.default)('PascalCase', 'sentence-case'), false);
});
(0, _ava2.default)('false for kebab-case on sentencecase', function (t) {
(0, _ava2.default)('false for kebab-case on sentencecase', t => {
t.is((0, _case2.default)('kebab-case', 'sentence-case'), false);
});
(0, _ava2.default)('false for snake_case on sentencecase', function (t) {
(0, _ava2.default)('false for snake_case on sentencecase', t => {
t.is((0, _case2.default)('snake_case', 'sentence-case'), false);
});
(0, _ava2.default)('false for camelCase on sentencecase', function (t) {
(0, _ava2.default)('false for camelCase on sentencecase', t => {
t.is((0, _case2.default)('camelCase', 'sentence-case'), false);
});
(0, _ava2.default)('true for * on sentence-case', function (t) {
var actual = (0, _case2.default)('*', 'sentence-case');
(0, _ava2.default)('true for * on sentence-case', t => {
const actual = (0, _case2.default)('*', 'sentence-case');
t.is(actual, true);
});
(0, _ava2.default)('true for * on camel-case', function (t) {
var actual = (0, _case2.default)('*', 'camel-case');
(0, _ava2.default)('true for * on camel-case', t => {
const actual = (0, _case2.default)('*', 'camel-case');
t.is(actual, true);
});
(0, _ava2.default)('true for * on kebab-case', function (t) {
var actual = (0, _case2.default)('*', 'kebab-case');
(0, _ava2.default)('true for * on kebab-case', t => {
const actual = (0, _case2.default)('*', 'kebab-case');
t.is(actual, true);
});
(0, _ava2.default)('true for * on snake-case', function (t) {
var actual = (0, _case2.default)('*', 'snake-case');
(0, _ava2.default)('true for * on snake-case', t => {
const actual = (0, _case2.default)('*', 'snake-case');
t.is(actual, true);
});
(0, _ava2.default)('true for * on pascal-case', function (t) {
var actual = (0, _case2.default)('*', 'snake-case');
(0, _ava2.default)('true for * on pascal-case', t => {
const actual = (0, _case2.default)('*', 'pascal-case');
t.is(actual, true);
});
(0, _ava2.default)('true for * on start-case', function (t) {
var actual = (0, _case2.default)('*', 'snake-case');
(0, _ava2.default)('true for * on start-case', t => {
const actual = (0, _case2.default)('*', 'start-case');
t.is(actual, true);
});
(0, _ava2.default)('true for `Any_CASE_iN_back-quotes` on lowercase', t => {
const actual = (0, _case2.default)('`Any_CASE_iN_back-quotes`', 'lowercase');
t.is(actual, true);
});
(0, _ava2.default)('true for `Any_CASE_iN_back-quotes` on uppercase', t => {
const actual = (0, _case2.default)('`Any_CASE_iN_back-quotes`', 'uppercase');
t.is(actual, true);
});
(0, _ava2.default)('true for `Any_CASE_iN_back-quotes` on sentence-case', t => {
const actual = (0, _case2.default)('`Any_CASE_iN_back-quotes`', 'sentence-case');
t.is(actual, true);
});
(0, _ava2.default)('true for `Any_CASE_iN_back-quotes` on camel-case', t => {
const actual = (0, _case2.default)('`Any_CASE_iN_back-quotes`', 'camel-case');
t.is(actual, true);
});
(0, _ava2.default)('true for `Any_CASE_iN_back-quotes` on kebab-case', t => {
const actual = (0, _case2.default)('`Any_CASE_iN_back-quotes`', 'kebab-case');
t.is(actual, true);
});
(0, _ava2.default)('true for `Any_CASE_iN_back-quotes` on snake-case', t => {
const actual = (0, _case2.default)('`Any_CASE_iN_back-quotes`', 'snake-case');
t.is(actual, true);
});
(0, _ava2.default)('true for `Any_CASE_iN_back-quotes` on pascal-case', t => {
const actual = (0, _case2.default)('`Any_CASE_iN_back-quotes`', 'pascal-case');
t.is(actual, true);
});
(0, _ava2.default)('true for `Any_CASE_iN_back-quotes` on start-case', t => {
const actual = (0, _case2.default)('`Any_CASE_iN_back-quotes`', 'start-case');
t.is(actual, true);
});
(0, _ava2.default)('true for lowercase `Any_CASE_iN_back-quotes` lowercase on lowercase', t => {
const actual = (0, _case2.default)('lowercase `Any_CASE_iN_back-quotes` lowercase', 'lowercase');
t.is(actual, true);
});
(0, _ava2.default)('false for UPPERCASE `Any_CASE_iN_back-quotes` UPPERCASE on lowercase', t => {
const actual = (0, _case2.default)('UPPERCASE `Any_CASE_iN_back-quotes` UPPERCASE', 'lowercase');
t.is(actual, false);
});
(0, _ava2.default)('true for UPPERCASE `Any_CASE_iN_back-quotes` UPPERCASE on uppercase', t => {
const actual = (0, _case2.default)('UPPERCASE `Any_CASE_iN_back-quotes` UPPERCASE', 'uppercase');
t.is(actual, true);
});
(0, _ava2.default)('false for lowercase `Any_CASE_iN_back-quotes` lowercase on uppercase', t => {
const actual = (0, _case2.default)('lowercase `Any_CASE_iN_back-quotes` lowercase', 'uppercase');
t.is(actual, false);
});
(0, _ava2.default)('true for fooBar`Any_CASE_iN_back-quotes`fooBar on camel-case', t => {
const actual = (0, _case2.default)('fooBar`Any_CASE_iN_back-quotes`fooBar', 'camel-case');
t.is(actual, true);
});
(0, _ava2.default)('false for Foo Bar`Any_CASE_iN_back-quotes` Foo Bar on camel-case', t => {
const actual = (0, _case2.default)('Foo Bar`Any_CASE_iN_back-quotes` Foo Bar', 'camel-case');
t.is(actual, false);
});
(0, _ava2.default)('true for foo-bar`Any_CASE_iN_back-quotes`foo-bar on kebab-case', t => {
const actual = (0, _case2.default)('foo-bar`Any_CASE_iN_back-quotes`foo-bar', 'kebab-case');
t.is(actual, true);
});
(0, _ava2.default)('false for Foo Bar `Any_CASE_iN_back-quotes` Foo Bar on kebab-case', t => {
const actual = (0, _case2.default)('Foo Bar `Any_CASE_iN_back-quotes` Foo Bar', 'kebab-case');
t.is(actual, false);
});
(0, _ava2.default)('true for foo_bar`Any_CASE_iN_back-quotes`foo_bar on snake-case', t => {
const actual = (0, _case2.default)('foo_bar`Any_CASE_iN_back-quotes`foo_bar', 'snake-case');
t.is(actual, true);
});
(0, _ava2.default)('false for Foo Bar `Any_CASE_iN_back-quotes` Foo Bar on snake-case', t => {
const actual = (0, _case2.default)('Foo Bar `Any_CASE_iN_back-quotes` Foo Bar', 'snake-case');
t.is(actual, false);
});
(0, _ava2.default)('true for PascalCase`Any_CASE_iN_back-quotes`PascalCase on pascal-case', t => {
const actual = (0, _case2.default)('PascalCase`Any_CASE_iN_back-quotes`PascalCase', 'pascal-case');
t.is(actual, true);
});
(0, _ava2.default)('false for Foo Bar `Any_CASE_iN_back-quotes` Foo Bar on pascal-case', t => {
const actual = (0, _case2.default)('Foo Bar `Any_CASE_iN_back-quotes` Foo Bar', 'pascal-case');
t.is(actual, false);
});
(0, _ava2.default)('true for Foo Bar`Any_CASE_iN_back-quotes` Foo Bar on start-case', t => {
const actual = (0, _case2.default)('Foo Bar `Any_CASE_iN_back-quotes`Foo Bar', 'start-case');
t.is(actual, true);
});
(0, _ava2.default)('false for foo_bar`Any_CASE_iN_back-quotes`foo_bar on start-case', t => {
const actual = (0, _case2.default)('foo_bar`Any_CASE_iN_back-quotes`foo_bar', 'start-case');
t.is(actual, false);
});
(0, _ava2.default)('true for lowercase `Any_CASE_iN_back-quotes` `Any_CASE_iN_back-quotes` lowercase on lowercase', t => {
const actual = (0, _case2.default)('lowercase `Any_CASE_iN_back-quotes` `Any_CASE_iN_back-quotes` lowercase', 'lowercase');
t.is(actual, true);
});
(0, _ava2.default)("true for 'Any_CASE_iN_single-quotes' on lowercase", t => {
const actual = (0, _case2.default)("'Any_CASE_iN_single-quotes'", 'lowercase');
t.is(actual, true);
});
(0, _ava2.default)('true for "Any_CASE_iN_double-quotes" on lowercase', t => {
const actual = (0, _case2.default)('"Any_CASE_iN_double-quotes"', 'lowercase');
t.is(actual, true);
});
(0, _ava2.default)('true for `lowercasel"\'` on lowercase', t => {
const actual = (0, _case2.default)('`lowercasel"\'`', 'lowercase');
t.is(actual, true);
});
(0, _ava2.default)('false for `LOWERCASE on lowercase', t => {
const actual = (0, _case2.default)('`LOWERCASE', 'lowercase');
t.is(actual, false);
});
//# sourceMappingURL=case.test.js.map

@@ -7,5 +7,3 @@ "use strict";

exports.default = function (value) {
var enums = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
exports.default = (value, enums = []) => {
if (value === undefined) {

@@ -12,0 +10,0 @@ return false;

@@ -13,41 +13,41 @@ 'use strict';

(0, _ava2.default)('false for no params', function (t) {
var actual = (0, _enum2.default)();
(0, _ava2.default)('false for no params', t => {
const actual = (0, _enum2.default)();
t.is(actual, false);
});
(0, _ava2.default)('true for a against a', function (t) {
var actual = (0, _enum2.default)('a', ['a']);
(0, _ava2.default)('true for a against a', t => {
const actual = (0, _enum2.default)('a', ['a']);
t.is(actual, true);
});
(0, _ava2.default)('false for a against b', function (t) {
var actual = (0, _enum2.default)('a', ['b']);
(0, _ava2.default)('false for a against b', t => {
const actual = (0, _enum2.default)('a', ['b']);
t.is(actual, false);
});
(0, _ava2.default)('true for a against a, b', function (t) {
var actual = (0, _enum2.default)('a', ['a', 'b']);
(0, _ava2.default)('true for a against a, b', t => {
const actual = (0, _enum2.default)('a', ['a', 'b']);
t.is(actual, true);
});
(0, _ava2.default)('false for b against a', function (t) {
var actual = (0, _enum2.default)('b', ['a']);
(0, _ava2.default)('false for b against a', t => {
const actual = (0, _enum2.default)('b', ['a']);
t.is(actual, false);
});
(0, _ava2.default)('true for b against b', function (t) {
var actual = (0, _enum2.default)('b', ['b']);
(0, _ava2.default)('true for b against b', t => {
const actual = (0, _enum2.default)('b', ['b']);
t.is(actual, true);
});
(0, _ava2.default)('true for b against a, b', function (t) {
var actual = (0, _enum2.default)('b', ['a', 'b']);
(0, _ava2.default)('true for b against a, b', t => {
const actual = (0, _enum2.default)('b', ['a', 'b']);
t.is(actual, true);
});
(0, _ava2.default)('false for c against a, b', function (t) {
var actual = (0, _enum2.default)('c', ['a', 'b']);
(0, _ava2.default)('false for c against a, b', t => {
const actual = (0, _enum2.default)('c', ['a', 'b']);
t.is(actual, false);
});
//# sourceMappingURL=enum.test.js.map

@@ -31,25 +31,20 @@ 'use strict';

(0, _ava2.default)('exports all rules', function (t) {
return new Promise(function ($return, $error) {
var expected, actual;
return Promise.resolve(glob('*.js')).then(function ($await_1) {
try {
expected = $await_1.map(function (f) {
return (0, _lodash2.default)(f);
});
actual = Object.keys(ensure);
t.deepEqual(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('exports all rules', t => new Promise(function ($return, $error) {
var expected, actual;
return Promise.resolve(glob('*.js')).then(function ($await_1) {
try {
expected = $await_1.map(f => (0, _lodash2.default)(f));
actual = Object.keys(ensure);
(0, _ava2.default)('rules export functions', function (t) {
var actual = (0, _lodash4.default)(ensure);
t.true(actual.every(function (rule) {
return typeof rule === 'function';
}));
t.deepEqual(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this)));
(0, _ava2.default)('rules export functions', t => {
const actual = (0, _lodash4.default)(ensure);
t.true(actual.every(rule => typeof rule === 'function'));
});

@@ -66,2 +61,3 @@

files = $await_2;
return $return(files.map(relative).map(toExport));

@@ -68,0 +64,0 @@ } catch ($boundEx) {

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

exports.default = function (value, max) {
return typeof value === 'string' && value.length <= max;
};
exports.default = (value, max) => typeof value === 'string' && value.length <= max;
module.exports = exports['default'];
//# sourceMappingURL=max-length.js.map

@@ -13,26 +13,26 @@ 'use strict';

(0, _ava2.default)('false for no params', function (t) {
var actual = (0, _maxLength2.default)();
(0, _ava2.default)('false for no params', t => {
const actual = (0, _maxLength2.default)();
t.is(actual, false);
});
(0, _ava2.default)('true for a against 1', function (t) {
var actual = (0, _maxLength2.default)('a', 1);
(0, _ava2.default)('true for a against 1', t => {
const actual = (0, _maxLength2.default)('a', 1);
t.is(actual, true);
});
(0, _ava2.default)('false for ab against 0', function (t) {
var actual = (0, _maxLength2.default)('a', 0);
(0, _ava2.default)('false for ab against 0', t => {
const actual = (0, _maxLength2.default)('a', 0);
t.is(actual, false);
});
(0, _ava2.default)('true for a against 2', function (t) {
var actual = (0, _maxLength2.default)('a', 2);
(0, _ava2.default)('true for a against 2', t => {
const actual = (0, _maxLength2.default)('a', 2);
t.is(actual, true);
});
(0, _ava2.default)('true for ab against 2', function (t) {
var actual = (0, _maxLength2.default)('ab', 2);
(0, _ava2.default)('true for ab against 2', t => {
const actual = (0, _maxLength2.default)('ab', 2);
t.is(actual, true);
});
//# sourceMappingURL=max-length.test.js.map

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

exports.default = function (value, min) {
return typeof value === 'string' && value.length >= min;
};
exports.default = (value, min) => typeof value === 'string' && value.length >= min;
module.exports = exports['default'];
//# sourceMappingURL=min-length.js.map

@@ -13,26 +13,26 @@ 'use strict';

(0, _ava2.default)('false for no params', function (t) {
var actual = (0, _minLength2.default)();
(0, _ava2.default)('false for no params', t => {
const actual = (0, _minLength2.default)();
t.is(actual, false);
});
(0, _ava2.default)('true for a against 1', function (t) {
var actual = (0, _minLength2.default)('a', 1);
(0, _ava2.default)('true for a against 1', t => {
const actual = (0, _minLength2.default)('a', 1);
t.is(actual, true);
});
(0, _ava2.default)('false for ab against 0', function (t) {
var actual = (0, _minLength2.default)('a', 0);
(0, _ava2.default)('false for ab against 0', t => {
const actual = (0, _minLength2.default)('a', 0);
t.is(actual, true);
});
(0, _ava2.default)('true for a against 2', function (t) {
var actual = (0, _minLength2.default)('a', 2);
(0, _ava2.default)('true for a against 2', t => {
const actual = (0, _minLength2.default)('a', 2);
t.is(actual, false);
});
(0, _ava2.default)('true for ab against 2', function (t) {
var actual = (0, _minLength2.default)('ab', 2);
(0, _ava2.default)('true for ab against 2', t => {
const actual = (0, _minLength2.default)('ab', 2);
t.is(actual, true);
});
//# sourceMappingURL=min-length.test.js.map

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

exports.default = function (value) {
return typeof value === 'string' && value.length > 0;
};
exports.default = value => typeof value === 'string' && value.length > 0;
module.exports = exports['default'];
//# sourceMappingURL=not-empty.js.map

@@ -13,16 +13,16 @@ 'use strict';

(0, _ava2.default)('false for no params', function (t) {
var actual = (0, _notEmpty2.default)();
(0, _ava2.default)('false for no params', t => {
const actual = (0, _notEmpty2.default)();
t.is(actual, false);
});
(0, _ava2.default)('false for ""', function (t) {
var actual = (0, _notEmpty2.default)('');
(0, _ava2.default)('false for ""', t => {
const actual = (0, _notEmpty2.default)('');
t.is(actual, false);
});
(0, _ava2.default)('true for a', function (t) {
var actual = (0, _notEmpty2.default)('a');
(0, _ava2.default)('true for a', t => {
const actual = (0, _notEmpty2.default)('a');
t.is(actual, true);
});
//# sourceMappingURL=not-empty.test.js.map
{
"name": "@commitlint/ensure",
"version": "6.1.3",
"version": "7.0.0",
"description": "Lint your commit messages",

@@ -62,7 +62,7 @@ "main": "lib/index.js",

"devDependencies": {
"@commitlint/test": "^6.1.3",
"@commitlint/utils": "^6.1.3",
"@commitlint/test": "^7.0.0",
"@commitlint/utils": "^7.0.0",
"ava": "0.22.0",
"babel-cli": "6.26.0",
"babel-preset-commitlint": "^6.1.3",
"babel-preset-commitlint": "^7.0.0",
"babel-register": "6.26.0",

@@ -69,0 +69,0 @@ "concurrently": "3.5.1",

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

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

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