import Ember from 'ember';

const emberMajorMinorVersion = Ember.VERSION.match(/(\d+\.\d+)\.*/)[1];
const isGlimmer = Number(emberMajorMinorVersion) >= 2.10;

let getMutValue;

if (isGlimmer) {
  const { MUTABLE_CELL } = Ember.__loader.require('ember-views/compat/attrs');
  getMutValue = (value) => {
    if (value && value[MUTABLE_CELL]) {
      return value.value;
    } else {
      return value;
    }
  };
} else {
  getMutValue = Ember.__loader.require('ember-glimmer/hooks/get-value')['default'];
}

export default function getMutableAttributes(attrs) {
  return Object.keys(attrs).reduce((acc, attr) => {
    acc[attr] = getMutValue(attrs[attr]);
    return acc;
  }, {});
}

import Ember from 'ember';

const [major, minor] = Ember.VERSION.split('.');
const isGlimmer = major >= 2 && minor >= 10; // >= 2.10

let getMutValue;

if (isGlimmer) {
  const { MUTABLE_CELL } = Ember.__loader.require('ember-views/compat/attrs');
  getMutValue = (value) => {
    if (value && value[MUTABLE_CELL]) {
      return value.value;
    } else {
      return value;
    }
  };
} else {
  getMutValue = Ember.__loader.require('ember-glimmer/hooks/get-value')['default'];
}

export default function getMutableAttributes(attrs) {
  return Object.keys(attrs).reduce((acc, attr) => {
    acc[attr] = getMutValue(attrs[attr]);
    return acc;
  }, {});
}

Fix Ember version check to determine Glimmer.
Fix Ember version check to determine Glimmer.

The original check does not work properly for Ember < 2.10. Example `2.6 >= 2.10` gives `true`.
