@denimlabs/fb-position-validation
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -92,3 +92,3 @@ "use strict"; | ||
if (isDefined(facebook_positions) && !(Array.isArray(facebook_positions) && facebook_positions.length === 0)) { | ||
if (isDefined(facebook_positions) && !(Array.isArray(facebook_positions) && (facebook_positions || []).length === 0)) { | ||
if (!containsOnlyValid(facebook_positions, VALID_FACEBOOK_POSITIONS)) { | ||
@@ -100,3 +100,3 @@ throw Error("invalid facebook position. Valid values are ".concat(VALID_FACEBOOK_POSITIONS)); | ||
if (facebook_positions.includes('feed') || instagram_positions.includes('story')) { | ||
if (device_platforms.length === 0 || device_platforms.includes('mobile')) { | ||
if ((device_platforms || []).length === 0 || device_platforms.includes('mobile')) { | ||
return true; | ||
@@ -116,3 +116,3 @@ } else { | ||
if (device_platforms.length > 0 && !device_platforms.includes('mobile')) { | ||
if ((device_platforms || []).length > 0 && !device_platforms.includes('mobile')) { | ||
throw Error('when using instant_article you can not select only desktop.'); | ||
@@ -127,3 +127,3 @@ } | ||
if (device_platforms.length > 0 && !device_platforms.includes('mobile')) { | ||
if ((device_platforms || []).length > 0 && !device_platforms.includes('mobile')) { | ||
throw Error('when using marketplace you can not select only desktop.'); | ||
@@ -134,3 +134,3 @@ } | ||
if (instagram_positions.length > 0) { | ||
if ((instagram_positions || []).length > 0) { | ||
if (!containsOnlyValid(instagram_positions, VALID_INSTAGRAM_POSTIONS)) { | ||
@@ -145,3 +145,3 @@ throw Error("invalid instagram position. Valid values are ".concat(VALID_INSTAGRAM_POSTIONS)); | ||
if (audience_network_positions.length > 0) { | ||
if ((audience_network_positions || []).length > 0) { | ||
if (!containsOnlyValid(audience_network_positions, VALID_AUDIENCE_NETWORK_POSITIONS)) { | ||
@@ -152,3 +152,3 @@ throw Error("invalid audience network position. Valid values are ".concat(VALID_AUDIENCE_NETWORK_POSITIONS)); | ||
if (messenger_positions.length > 0) { | ||
if ((messenger_positions || []).length > 0) { | ||
if (!containsOnlyValid(messenger_positions, VALID_MESSENGER_POSITIONS)) { | ||
@@ -159,7 +159,7 @@ throw Error("invalid messenger positions. Valid values are ".concat(VALID_MESSENGER_POSITIONS, ".")); | ||
if (messenger_positions.includes('messenger_home')) { | ||
if (publisher_platforms.length > 0 && !publisher_platforms.includes('facebook')) { | ||
if ((publisher_platforms || []).length > 0 && !publisher_platforms.includes('facebook')) { | ||
throw Error('You must select facebook for publisher platform when using messenger home.'); | ||
} | ||
if (facebook_positions.length > 0 && !facebook_positions.includes('feed')) { | ||
if ((facebook_positions || []).length > 0 && !facebook_positions.includes('feed')) { | ||
throw Error('You must select facebook feed when using messenger home.'); | ||
@@ -169,3 +169,3 @@ } | ||
if (device_platforms.length > 0 && !device_platforms.includes('mobile')) { | ||
if ((device_platforms || []).length > 0 && !device_platforms.includes('mobile')) { | ||
throw Error('when using messenger_positions you can not select only desktop.'); | ||
@@ -181,3 +181,3 @@ } | ||
if (publisher_platforms.length > 0 && !publisher_platforms.includes('facebook')) { | ||
if ((publisher_platforms || []).length > 0 && !publisher_platforms.includes('facebook')) { | ||
throw Error('when providing publisher_platforms you must include facebook.'); | ||
@@ -198,5 +198,6 @@ } | ||
function validateDevicePlatformsAgainstValidObjectiveDevicePlatforms(validDevicePlatforms, positioning) { | ||
var device_platforms = positioning.device_platforms; | ||
var _positioning$device_p2 = positioning.device_platforms, | ||
device_platforms = _positioning$device_p2 === void 0 ? [] : _positioning$device_p2; | ||
if (device_platforms.length > 0 && !containsOnlyValid(device_platforms, validDevicePlatforms)) { | ||
if ((device_platforms || []).length > 0 && !containsOnlyValid(device_platforms, validDevicePlatforms)) { | ||
throw Error('invalid device platforms for objective'); | ||
@@ -210,3 +211,3 @@ } | ||
if (publisher_platforms.length > 0 && !containsOnlyValid(publisher_platforms, validPublisherPlatforms)) { | ||
if ((publisher_platforms || []).length > 0 && !containsOnlyValid(publisher_platforms, validPublisherPlatforms)) { | ||
throw Error('invalid publisher platform for objective'); | ||
@@ -230,3 +231,3 @@ } | ||
if (facebook_positions.length > 0) { | ||
if ((facebook_positions || []).length > 0) { | ||
if (!containsOnlyValid(facebook_positions, validFacebookPositions)) { | ||
@@ -237,3 +238,3 @@ throw Error('Invalid facebook_positions for this objective'); | ||
if (instagram_positions.length > 0) { | ||
if ((instagram_positions || []).length > 0) { | ||
if (!containsOnlyValid(instagram_positions, validInsagramPositions)) { | ||
@@ -244,3 +245,3 @@ throw Error('Invalid instagram_positions for this objective'); | ||
if (audience_network_positions.length > 0) { | ||
if ((audience_network_positions || []).length > 0) { | ||
if (!containsOnlyValid(audience_network_positions, validAudienceNetworkPositions)) { | ||
@@ -251,3 +252,3 @@ throw Error('Invalid audience_network_positions for this objective'); | ||
if (messenger_positions.length > 0) { | ||
if ((messenger_positions || []).length > 0) { | ||
if (!containsOnlyValid(messenger_positions, validMessengerPositions)) { | ||
@@ -254,0 +255,0 @@ throw Error('Invalid messenger_positions for this objective'); |
{ | ||
"name": "@denimlabs/fb-position-validation", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Validate facebook positions against denim campaign objectives.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
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
56660
894