Skip to content

refactor: Convert lib/core to ES module (Part 1/2) #449

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

Merged
merged 7 commits into from
Apr 10, 2020
Merged
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
26 changes: 14 additions & 12 deletions packages/optimizely-sdk/lib/core/audience_evaluator/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2016, 2018-2019 Optimizely
* Copyright 2016, 2018-2020, Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,17 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var conditionTreeEvaluator = require('../condition_tree_evaluator');
var customAttributeConditionEvaluator = require('../custom_attribute_condition_evaluator');
var enums = require('../../utils/enums');
var fns = require('../../utils/fns');
var sprintf = require('@optimizely/js-sdk-utils').sprintf;
var logging = require('@optimizely/js-sdk-logging');
var logger = logging.getLogger();
import { sprintf } from '@optimizely/js-sdk-utils';
import { getLogger } from '@optimizely/js-sdk-logging';

var ERROR_MESSAGES = enums.ERROR_MESSAGES;
var LOG_LEVEL = enums.LOG_LEVEL;
var LOG_MESSAGES = enums.LOG_MESSAGES;
import fns from '../../utils/fns';
import {
LOG_LEVEL,
LOG_MESSAGES,
ERROR_MESSAGES,
} from '../../utils/enums';
import conditionTreeEvaluator from '../condition_tree_evaluator';
import customAttributeConditionEvaluator from '../custom_attribute_condition_evaluator';

var logger = getLogger();
var MODULE_NAME = 'AUDIENCE_EVALUATOR';

/**
Expand Down Expand Up @@ -108,4 +110,4 @@ AudienceEvaluator.prototype.evaluateConditionWithUserAttributes = function(userA
return null;
};

module.exports = AudienceEvaluator;
export default AudienceEvaluator;
21 changes: 10 additions & 11 deletions packages/optimizely-sdk/lib/core/audience_evaluator/index.tests.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2016, 2018-2019 Optimizely
* Copyright 2016, 2018-2020, Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var AudienceEvaluator = require('./');
var chai = require('chai');
var conditionTreeEvaluator = require('../condition_tree_evaluator');
var customAttributeConditionEvaluator = require('../custom_attribute_condition_evaluator');
var sinon = require('sinon');
var assert = chai.assert;
var logging = require('@optimizely/js-sdk-logging');
var mockLogger = logging.getLogger();
var enums = require('../../utils/enums');
var LOG_LEVEL = enums.LOG_LEVEL;
import sinon from 'sinon';
import { assert } from 'chai';
import { getLogger } from '@optimizely/js-sdk-logging';

import AudienceEvaluator from './index';
import conditionTreeEvaluator from '../condition_tree_evaluator';
import customAttributeConditionEvaluator from '../custom_attribute_condition_evaluator';

var mockLogger = getLogger();

var chromeUserAudience = {
conditions: [
Expand Down
Loading