Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CI/CD with automatic versioning and changelog #195

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion dist/v8n.amd.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ define(function () { 'use strict';
}

function v8n() {
return proxyContext(new Context());
return typeof Proxy !== undefined
? proxyContext(new Context())
: proxylessContext(new Context());
}

// Custom rules
Expand Down Expand Up @@ -231,6 +233,42 @@ define(function () { 'use strict';
});
}

function proxylessContext(context) {
var addRuleSet = function (ruleSet, targetContext) {
Object.keys(ruleSet).forEach(function (prop) {
targetContext[prop] = function () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];

var newContext = proxylessContext(targetContext._clone());
var contextWithRuleApplied = newContext._applyRule(
ruleSet[prop],
prop
).apply(void 0, args);
return contextWithRuleApplied;
};
});
return targetContext;
};

var contextWithAvailableRules = addRuleSet(availableRules, context);
var contextWithAllRules = addRuleSet(
customRules,
contextWithAvailableRules
);

Object.keys(availableModifiers).forEach(function (prop) {
Object.defineProperty(contextWithAllRules, prop, {
get: function () {
var newContext = proxylessContext(contextWithAllRules._clone());
return newContext._applyModifier(availableModifiers[prop], prop);
}
});
});

return contextWithAllRules;
}

var availableModifiers = {
not: {
simple: function (fn) { return function (value) { return !fn(value); }; },
Expand Down
40 changes: 39 additions & 1 deletion dist/v8n.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ var v8n = (function () {
}

function v8n() {
return proxyContext(new Context());
return typeof Proxy !== undefined
? proxyContext(new Context())
: proxylessContext(new Context());
}

// Custom rules
Expand Down Expand Up @@ -232,6 +234,42 @@ var v8n = (function () {
});
}

function proxylessContext(context) {
var addRuleSet = function (ruleSet, targetContext) {
Object.keys(ruleSet).forEach(function (prop) {
targetContext[prop] = function () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];

var newContext = proxylessContext(targetContext._clone());
var contextWithRuleApplied = newContext._applyRule(
ruleSet[prop],
prop
).apply(void 0, args);
return contextWithRuleApplied;
};
});
return targetContext;
};

var contextWithAvailableRules = addRuleSet(availableRules, context);
var contextWithAllRules = addRuleSet(
customRules,
contextWithAvailableRules
);

Object.keys(availableModifiers).forEach(function (prop) {
Object.defineProperty(contextWithAllRules, prop, {
get: function () {
var newContext = proxylessContext(contextWithAllRules._clone());
return newContext._applyModifier(availableModifiers[prop], prop);
}
});
});

return contextWithAllRules;
}

var availableModifiers = {
not: {
simple: function (fn) { return function (value) { return !fn(value); }; },
Expand Down
2 changes: 1 addition & 1 deletion dist/v8n.browser.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/v8n.browser.min.js.map

Large diffs are not rendered by default.

40 changes: 39 additions & 1 deletion dist/v8n.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ function executeAsyncRules(value, rules, resolve, reject) {
}

function v8n() {
return proxyContext(new Context());
return typeof Proxy !== undefined
? proxyContext(new Context())
: proxylessContext(new Context());
}

// Custom rules
Expand Down Expand Up @@ -231,6 +233,42 @@ function proxyContext(context) {
});
}

function proxylessContext(context) {
var addRuleSet = function (ruleSet, targetContext) {
Object.keys(ruleSet).forEach(function (prop) {
targetContext[prop] = function () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];

var newContext = proxylessContext(targetContext._clone());
var contextWithRuleApplied = newContext._applyRule(
ruleSet[prop],
prop
).apply(void 0, args);
return contextWithRuleApplied;
};
});
return targetContext;
};

var contextWithAvailableRules = addRuleSet(availableRules, context);
var contextWithAllRules = addRuleSet(
customRules,
contextWithAvailableRules
);

Object.keys(availableModifiers).forEach(function (prop) {
Object.defineProperty(contextWithAllRules, prop, {
get: function () {
var newContext = proxylessContext(contextWithAllRules._clone());
return newContext._applyModifier(availableModifiers[prop], prop);
}
});
});

return contextWithAllRules;
}

var availableModifiers = {
not: {
simple: function (fn) { return function (value) { return !fn(value); }; },
Expand Down
37 changes: 36 additions & 1 deletion dist/v8n.esm.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ function executeAsyncRules(value, rules, resolve, reject) {
}

function v8n() {
return proxyContext(new Context());
return typeof Proxy !== undefined
? proxyContext(new Context())
: proxylessContext(new Context());
}

// Custom rules
Expand Down Expand Up @@ -212,6 +214,39 @@ function proxyContext(context) {
});
}

function proxylessContext(context) {
const addRuleSet = (ruleSet, targetContext) => {
Object.keys(ruleSet).forEach(prop => {
targetContext[prop] = (...args) => {
const newContext = proxylessContext(targetContext._clone());
const contextWithRuleApplied = newContext._applyRule(
ruleSet[prop],
prop
)(...args);
return contextWithRuleApplied;
};
});
return targetContext;
};

const contextWithAvailableRules = addRuleSet(availableRules, context);
const contextWithAllRules = addRuleSet(
customRules,
contextWithAvailableRules
);

Object.keys(availableModifiers).forEach(prop => {
Object.defineProperty(contextWithAllRules, prop, {
get: () => {
const newContext = proxylessContext(contextWithAllRules._clone());
return newContext._applyModifier(availableModifiers[prop], prop);
}
});
});

return contextWithAllRules;
}

const availableModifiers = {
not: {
simple: fn => value => !fn(value),
Expand Down
Loading