Code coverage report for api/unicode/UnicodeSymbol.js

Statements: 87.5% (21 / 24)      Branches: 50% (4 / 8)      Functions: 100% (4 / 4)      Lines: 87.5% (21 / 24)      Ignored: none     

All files » api/unicode/ » UnicodeSymbol.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 671                     1 510 510   510 510     1                           5507     510     510       510 510   510           382 382   382 382 382   382 382         1  
var FieldDBObject = require("./../FieldDBObject").FieldDBObject;
 
/**
 * @class UnicodeSymbol allows a user to use IPA symbols, characters other than Roman alphabets, etc..
 *    Users can add new symbols. Added symbols are saved and stored, and will show up next time the user
 *    opens UnicodeSymbol box.
 *
 * @name  UnicodeSymbol
 * @extends FieldDBObject
 * @constructs
 */
var UnicodeSymbol = function UnicodeSymbol(options) {
  Eif (!this._fieldDBtype) {
    this._fieldDBtype = "UnicodeSymbol";
  }
  this.debug("Constructing UnicodeSymbol length: ", options);
  FieldDBObject.apply(this, arguments);
};
 
UnicodeSymbol.prototype = Object.create(FieldDBObject.prototype, /** @lends UnicodeSymbol.prototype */ {
  constructor: {
    value: UnicodeSymbol
  },
 
  defaults: {
    value: {
      symbol: "",
      tipa: "",
      useCount: 0
    }
  },
  symbol: {
    get: function() {
      return this._symbol;
    },
    set: function(value) {
      Iif (value === this._symbol) {
        return;
      }
      Iif (!value) {
        delete this._symbol;
        return;
      }
      Eif (typeof value.trim === "function") {
        value = value.trim();
      }
      this._symbol = value.trim();
    }
  },
 
  toJSON: {
    value: function(includeEvenEmptyAttributes, removeEmptyAttributes) {
      this.debug("Customizing toJSON ", includeEvenEmptyAttributes, removeEmptyAttributes);
      var json = FieldDBObject.prototype.toJSON.apply(this, arguments);
 
      delete json.dateCreated;
      delete json.dateModified;
      delete json.version;
 
      this.debug(json);
      return json;
    }
  }
 
});
exports.UnicodeSymbol = UnicodeSymbol;