<commit_before>import Ember from 'ember';
import DS from 'ember-data';
import WithLogger from '../mixins/with-logger';
import SailsSocketAdapter from 'ember-data-sails/adapters/sails-socket';
//import ENV from '../config/environment';


var $ = Ember.$;
var EmberString = Ember.String;
var fmt = EmberString.fmt;
var pluralize = EmberString.pluralize;


function blueprintsWrapMethod(method) {
  return function () {
    return (this.get('useSailsEmberBlueprints') ? this._super : method).apply(this, arguments);
  };
}


/**
 * @class SailsSerializer
 * @extends DS.RESTSerializer
 */
var SailsSerializer = DS.RESTSerializer.extend(WithLogger, {
  /**
   * Whether to use `sails-generate-ember-blueprints` or not
   * @since 0.0.15
   * @property useSailsEmberBlueprints
   * @type Boolean
   */
  useSailsEmberBlueprints: false,//ENV.APP.emberDataSails.useSailsEmberBlueprints,

  /**
   * @since 0.0.11
   * @method extractArray
   * @inheritDoc
   */
  extractArray: blueprintsWrapMethod(function (store, primaryType, payload) {
    var newPayload = {};
    newPayload[pluralize(primaryType.typeKey)] = payload;
    return this._super(store, primaryType, newPayload);
  }),

  /**
   * @since 0.0.11
   * @method extractSingle
   * @inheritDoc
   */
  extractSingle: blueprintsWrapMethod(function (store, primaryType, payload, recordId) {
    var newPayload;
    if (payload === null) {
      return this._super.apply(this, arguments);
    }
    newPayload = {};
    newPayload[pluralize(primaryType.typeKey)] = [payload];
    return this._super(store, primaryType, newPayload, recordId);
  }),

  /**
   * @since 0.0.11
   * @method extractDeleteRecord<commit_msg>Update sails.js<commit_after>import Ember from 'ember';
import DS from 'ember-data';
import WithLogger from '../mixins/with-logger';
import SailsSocketAdapter from 'ember-data-sails/adapters/sails-socket';
//import ENV from '../config/environment';


var $ = Ember.$;
var EmberString = Ember.String;
var fmt = EmberString.fmt;
var pluralize = EmberString.pluralize;


function blueprintsWrapMethod(method) {
  return function () {
    return (this.get('useSailsEmberBlueprints') ? this._super : method).apply(this, arguments);
  };
}


/**
 * @class SailsSerializer
 * @extends DS.RESTSerializer
 */
var SailsSerializer = DS.RESTSerializer.extend(WithLogger, {
  /**
   * Whether to use `sails-generate-ember-blueprints` or not
   * @since 0.0.15
   * @property useSailsEmberBlueprints
   * @type Boolean
   */
  useSailsEmberBlueprints: true,//ENV.APP.emberDataSails.useSailsEmberBlueprints,

  /**
   * @since 0.0.11
   * @method extractArray
   * @inheritDoc
   */
  extractArray: blueprintsWrapMethod(function (store, primaryType, payload) {
    var newPayload = {};
    newPayload[pluralize(primaryType.typeKey)] = payload;
    return this._super(store, primaryType, newPayload);
  }),

  /**
   * @since 0.0.11
   * @method extractSingle
   * @inheritDoc
   */
  extractSingle: blueprintsWrapMethod(function (store, primaryType, payload, recordId) {
    var newPayload;
    if (payload === null) {
      return this._super.apply(this, arguments);
    }
    newPayload = {};
    newPayload[pluralize(primaryType.typeKey)] = [payload];
    return this._super(store, primaryType, newPayload, recordId);
  }),

  /**
   * @since 0.0.11
   * @method extractDeleteRecord
{'fraction_non_alphanumeric': 0.13387241689128482, 'fraction_numerical': 0.009583707696915245, 'mean_word_length': 3.861717612809316, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5771364', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1059, 'n_words': 220}