d2l-lms-launch-darkly-feature-converter-plugin
Advanced tools
Comparing version 0.6.0 to 0.7.0
{ | ||
"name": "d2l-lms-launch-darkly-feature-converter-plugin", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
const _ = require( 'lodash' ); | ||
const duplicatesDeep = require( './utils.js' ).duplicatesDeep; | ||
@@ -20,2 +21,11 @@ module.exports = class EnvironmentMapper { | ||
const duplciateTargets = duplicatesDeep( | ||
_.map( targets, t => t.values ) | ||
); | ||
if( duplciateTargets.length > 0 ) { | ||
const msg = `Duplicate targets: ${ _.join( duplciateTargets, ', ' ) }`; | ||
throw new Error( msg ); | ||
} | ||
const rules = _.map( | ||
@@ -22,0 +32,0 @@ definition.rules || [], |
const _ = require( 'lodash' ); | ||
const anyIntersections = require( '../utils.js' ).anyIntersections; | ||
const duplicatesDeep = require( '../utils.js' ).duplicatesDeep; | ||
@@ -46,7 +46,7 @@ module.exports = class InstanceTargetsMapper { | ||
const duplicates = _.orderBy( | ||
anyIntersections( | ||
duplicatesDeep( [ | ||
implicitInstanceIds, | ||
explicitInstanceIds, | ||
mixedExplicitInstanceIds | ||
) | ||
] ) | ||
); | ||
@@ -53,0 +53,0 @@ |
const _ = require( 'lodash' ); | ||
const anyIntersections = require( '../utils.js' ).anyIntersections; | ||
const duplicatesDeep = require( '../utils.js' ).duplicatesDeep; | ||
@@ -46,7 +46,7 @@ module.exports = class OrgTargetsMapper { | ||
const duplicates = _.orderBy( | ||
anyIntersections( | ||
duplicatesDeep( [ | ||
implicitTenantIds, | ||
explicitTenantIds, | ||
mixedExplicitTenantIds | ||
) | ||
] ) | ||
); | ||
@@ -53,0 +53,0 @@ |
const _ = require( 'lodash' ); | ||
function anyIntersections( items1, items2, items3 ) { | ||
function duplicatesDeep( arrays ) { | ||
const intersections = _.uniq( | ||
_.flatten( [ | ||
_.intersection( | ||
items1, | ||
items2 | ||
), | ||
_.intersection( | ||
items1, | ||
items3 | ||
), | ||
_.intersection( | ||
items2, | ||
items3 | ||
) | ||
] ) | ||
); | ||
const visited = new Set(); | ||
const duplicates = new Set(); | ||
return intersections; | ||
const all = _.flattenDeep( arrays ); | ||
_.forEach( all, item => { | ||
if( visited.has( item ) ) { | ||
duplicates.add( item ); | ||
} else { | ||
visited.add( item ); | ||
} | ||
} ); | ||
return Array.from( duplicates ); | ||
} | ||
module.exports = { | ||
anyIntersections | ||
duplicatesDeep | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110600
50
4497