mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-08-12 20:22:30 +00:00
Cleanup
This commit is contained in:
@@ -9,6 +9,12 @@
|
||||
},
|
||||
"rules": {
|
||||
"indent": ["error", 2],
|
||||
"max-len": ["error", {
|
||||
"code": 100,
|
||||
"ignoreStrings": true,
|
||||
"ignoreTemplateLiterals": true,
|
||||
"ignoreTrailingComments": true
|
||||
}],
|
||||
"node/exports-style": ["error", "module.exports"],
|
||||
"node/file-extension-in-import": ["error", "always"],
|
||||
"node/prefer-global/buffer": ["error", "always"],
|
||||
|
||||
+7
-1
@@ -6,7 +6,13 @@ if (!CI) {
|
||||
require('dotenv').config({ path: path.resolve(`.env.${ENV}`) });
|
||||
}
|
||||
|
||||
const { DOMAIN_USER, DOMAIN_API_KEY, DOMAIN_DOMAIN, DOMAIN_API_HOST, DOMAIN_API_PORT } = process.env;
|
||||
const {
|
||||
DOMAIN_USER,
|
||||
DOMAIN_API_KEY,
|
||||
DOMAIN_DOMAIN,
|
||||
DOMAIN_API_HOST,
|
||||
DOMAIN_API_PORT,
|
||||
} = process.env;
|
||||
|
||||
const IS_TEST = ENV === 'test';
|
||||
|
||||
|
||||
+20
-2
@@ -8,7 +8,9 @@ const between = (min, max) => num => num >= min && num <= max;
|
||||
const testRegex = regex => str => !!(str && str.match(regex));
|
||||
|
||||
const validate = pattern => data => R.compose(
|
||||
invalidPairs => invalidPairs.length ? { errors: invalidPairs, valid: false } : { errors: [], valid: true },
|
||||
invalidPairs => invalidPairs.length
|
||||
? { errors: invalidPairs, valid: false }
|
||||
: { errors: [], valid: true },
|
||||
R.filter(([key, { fn }]) => fn ? !fn(data[key]) : false),
|
||||
R.toPairs,
|
||||
)(pattern);
|
||||
@@ -30,5 +32,21 @@ const batchLazyTasks = count => tasks => tasks.reduce((batches, task) => {
|
||||
return [...full, [...last, task]];
|
||||
}, []);
|
||||
|
||||
module.exports = { or, and, validate, between, testRegex, log, print, then, lazyTask, batchLazyTasks };
|
||||
const withLengthGte = n => R.compose(R.gte(R.__, n), R.length);
|
||||
const withLengthEq = n => R.compose(R.equals(n), R.length);
|
||||
|
||||
module.exports = {
|
||||
or,
|
||||
and,
|
||||
validate,
|
||||
between,
|
||||
testRegex,
|
||||
log,
|
||||
print,
|
||||
then,
|
||||
lazyTask,
|
||||
batchLazyTasks,
|
||||
withLengthEq,
|
||||
withLengthGte,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
const R = require('ramda');
|
||||
const { VALID_RECORD_TYPES } = require('./constants');
|
||||
const { or, and, validate, between, testRegex } = require('./helpers');
|
||||
const withLengthGte = n => R.compose(R.gte(R.__, n), R.length);
|
||||
const withLengthEq = n => R.compose(R.equals(n), R.length);
|
||||
const { or, and, validate, between, testRegex, withLengthEq, withLengthGte } = require('./helpers');
|
||||
|
||||
const validateCnameRecord = key => and([
|
||||
R.propSatisfies(R.is(String), key),
|
||||
|
||||
Reference in New Issue
Block a user