Skip to content

Commit

Permalink
Merge pull request #36 from zumba/ci-work
Browse files Browse the repository at this point in the history
Updated dev dependencies and updated node list
  • Loading branch information
jrbasso authored Jul 25, 2022
2 parents 4c80079 + 8cd1456 commit e220eab
Show file tree
Hide file tree
Showing 11 changed files with 2,059 additions and 6,202 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 15.x]
node-version: [14.x, 16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand All @@ -27,3 +27,4 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test
timeout-minutes: 5
6 changes: 3 additions & 3 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 15.x]
node-version: [14.x, 16.x, 18.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -29,7 +29,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
Expand All @@ -46,7 +46,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
node-version: 16
registry-url: https://npm.pkg.github.com/
- run: npm ci
- run: npm publish
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swiveljs",
"version": "2.1.0",
"version": "2.1.1",
"description": "Strategy driven, segmented feature toggles",
"main": "dist/swivel.js",
"license": "MIT",
Expand Down
92 changes: 53 additions & 39 deletions dist/swivel.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,46 @@
;(function SwivelJS(undefined) {
'use strict';
/**
* SwivelJS v2.1.0 - 2018-05-29
* SwivelJS v2.1.1 - 2022-07-24
* Strategy driven, segmented feature toggles
*
* Copyright (c) 2018 Zumba®
* Copyright (c) 2022 Zumba®
* Licensed MIT
*/
/* jshint freeze: false */
/* jshint maxcomplexity: 9 */

// Production steps of ECMA-262, Edition 5, 15.4.4.21
// Reference: http://es5.github.io/#x15.4.4.21
if (!Array.prototype.reduce) {
Array.prototype.reduce = function(callback /*, initialValue*/) {
if (this === null || this === undefined) {
throw new TypeError('Array.prototype.reduce called on null or undefined');
}
if (typeof callback !== 'function') {
throw new TypeError(callback + ' is not a function');
}
var t = Object(this), len = t.length >>> 0, k = 0, value;
if (arguments.length === 2) {
value = arguments[1];
} else {
while (k < len && !(k in t)) {
k++;
Object.defineProperty(Array.prototype, 'reduce', {
value: function(callback /*, initialValue*/) {
/* jshint maxcomplexity: 10 */
if (this === null || this === undefined) {
throw new TypeError('Array.prototype.reduce called on null or undefined');
}
if (k >= len) {
throw new TypeError('Reduce of empty array with no initial value');
if (typeof callback !== 'function') {
throw new TypeError(callback + ' is not a function');
}
value = t[k++];
}
for (; k < len; k++) {
if (k in t) {
value = callback(value, t[k], k, t);
var t = Object(this), len = t.length >>> 0, k = 0, value;
if (arguments.length === 2) {
value = arguments[1];
} else {
while (k < len && !(k in t)) {
k++;
}
if (k >= len) {
throw new TypeError('Reduce of empty array with no initial value');
}
value = t[k++];
}
for (; k < len; k++) {
if (k in t) {
value = callback(value, t[k], k, t);
}
}
return value;
}
return value;
};
});
}

/* jshint freeze: true */
/* jshint maxcomplexity: 6 */

/**
* Delimiter
*
Expand Down Expand Up @@ -274,13 +271,16 @@
};

/**
* Used by reduceToBitmask
* Used by parse reducer
*
* @param Number mask
* @param Number index
* @return Number
*/
var bitmaskIterator = function bitmaskIterator(mask, index) {
if (!index || parseInt(index, 10) === 0) {
return mask;
}
return mask | 1 << --index;
};

Expand Down Expand Up @@ -335,6 +335,25 @@
return data;
};

/**
* Return the existent fields in base that are missing in compared
*
* @param Object base
* @param Object compared
* @returns Object
*/
var diffMissing = function(base, compared) {
var data = {};
var key;

for (key in base) {
if (base.hasOwnProperty(key) && compared[key] === undefined) {
data[key] = base[key];
}
}
return data;
};

/**
* Merge this map with another map and return a new one.
*
Expand All @@ -361,7 +380,7 @@
FeatureMapPrototype.diff = function diff(featureMap) {
var base = this.map;
var compared = featureMap.map;
var data = {};
var data = Object.assign(diffMissing(compared, base), diffMissing(base, compared));
var key;

for (key in compared) {
Expand All @@ -370,12 +389,6 @@
}
}

for (key in base) {
if (base.hasOwnProperty(key) && compared[key] === undefined) {
data[key] = base[key];
}
}

return new FeatureMap(data);
};

Expand All @@ -401,7 +414,7 @@
key += key ? DELIMITER + child : child;

var isMissing = !this.slugExists(key);
var isDisabled = isMissing || !(map[key] & index);
var isDisabled = isMissing || !(parseInt(map[key], 10) & index);

if (isMissing || isDisabled) {
return false;
Expand Down Expand Up @@ -575,6 +588,7 @@
};

(function exportSwivel(root) {
/* jshint maxcomplexity: false */

/**
* Free variable exports
Expand Down
7 changes: 3 additions & 4 deletions dist/swivel.min.js

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

Loading

0 comments on commit e220eab

Please sign in to comment.