Skip to content

Commit

Permalink
prepare 3.2.5 release (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaunchDarklyCI authored Mar 18, 2020
1 parent a798891 commit 40f3110
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ rules:
- error
- props: true

no-prototype-builtins: warn

# https://eslint.org/docs/rules/no-return-assign
no-return-assign: error

Expand Down
4 changes: 2 additions & 2 deletions src/Stream.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as messages from './messages';
import { base64URLEncode, getLDHeaders } from './utils';
import { base64URLEncode, getLDHeaders, objectHasOwnProperty } from './utils';

// The underlying event source implementation is abstracted via the platform object, which should
// have these three properties:
Expand Down Expand Up @@ -109,7 +109,7 @@ export default function Stream(platform, config, environment, diagnosticsAccumul

es = platform.eventSourceFactory(url, options);
for (const key in handlers) {
if (handlers.hasOwnProperty(key)) {
if (objectHasOwnProperty(handlers, key)) {
es.addEventListener(key, handlers[key]);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export function initialize(env, user, specifiedOptions, platform, extraOptionDef
function variationDetailInternal(key, defaultValue, sendEvent, includeReasonInEvent) {
let detail;

if (flags && flags.hasOwnProperty(key) && flags[key] && !flags[key].deleted) {
if (flags && utils.objectHasOwnProperty(flags, key) && flags[key] && !flags[key].deleted) {
const flag = flags[key];
detail = getFlagDetail(flag);
if (flag.value === null || flag.value === undefined) {
Expand Down Expand Up @@ -294,7 +294,7 @@ export function initialize(env, user, specifiedOptions, platform, extraOptionDef
}

for (const key in flags) {
if (flags.hasOwnProperty(key)) {
if (utils.objectHasOwnProperty(flags, key)) {
results[key] = variationDetailInternal(key, null, !options.sendEventsOnlyForVariation).value;
}
}
Expand Down Expand Up @@ -407,7 +407,7 @@ export function initialize(env, user, specifiedOptions, platform, extraOptionDef
}

for (const key in flags) {
if (flags.hasOwnProperty(key) && flags[key]) {
if (utils.objectHasOwnProperty(flags, key) && flags[key]) {
if (newFlags[key] && !utils.deepEquals(newFlags[key].value, flags[key].value)) {
changes[key] = { previous: flags[key].value, current: getFlagDetail(newFlags[key]) };
} else if (!newFlags[key] || newFlags[key].deleted) {
Expand All @@ -416,7 +416,7 @@ export function initialize(env, user, specifiedOptions, platform, extraOptionDef
}
}
for (const key in newFlags) {
if (newFlags.hasOwnProperty(key) && newFlags[key] && (!flags[key] || flags[key].deleted)) {
if (utils.objectHasOwnProperty(newFlags, key) && newFlags[key] && (!flags[key] || flags[key].deleted)) {
changes[key] = { current: getFlagDetail(newFlags[key]) };
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function wrapPromiseCallback(promise, callback) {
export function transformValuesToVersionedValues(flags) {
const ret = {};
for (const key in flags) {
if (flags.hasOwnProperty(key)) {
if (objectHasOwnProperty(flags, key)) {
ret[key] = { value: flags[key], version: 0 };
}
}
Expand All @@ -98,7 +98,7 @@ export function transformValuesToVersionedValues(flags) {
export function transformVersionedValuesToValues(flagsState) {
const ret = {};
for (const key in flagsState) {
if (flagsState.hasOwnProperty(key)) {
if (objectHasOwnProperty(flagsState, key)) {
ret[key] = flagsState[key].value;
}
}
Expand Down Expand Up @@ -169,6 +169,10 @@ export function extend(...objects) {
return objects.reduce((acc, obj) => ({ ...acc, ...obj }), {});
}

export function objectHasOwnProperty(object, name) {
return Object.prototype.hasOwnProperty.call(object, name);
}

export function sanitizeUser(user) {
if (!user) {
return user;
Expand Down

0 comments on commit 40f3110

Please sign in to comment.