<commit_before>import {inject, bindable, bindingMode, DOM} from 'aurelia-framework';
import $ from 'jquery';
import 'bootstrap-tagsinput/dist/bootstrap-tagsinput';
import {globalExtraOptions, globalPickerOptions} from './picker-global-options';

@inject(Element)
export class AbpTagsInputCustomElement {
  @bindable({defaultBindingMode: bindingMode.twoWay}) element;
  @bindable({defaultBindingMode: bindingMode.twoWay}) value;

  // plugin own variables
  @bindable bootstrapVersion = globalExtraOptions.bootstrapVersion;
  @bindable placeholder = '';

  // picker options
  @bindable options;

  // events (from the View)
  @bindable onBeforeItemAdd;
  @bindable onBeforeItemRemove;
  @bindable onItemAdded;
  @bindable onItemAddedOnInit;
  @bindable onItemRemoved;

  // variables
  events = {};
  methods = {};
  options = {};
  suppressValueChanged;

  constructor(elm) {
    this.elm = elm;

    // ensure the element exposes a "focus" method for Aurelia-Validation
    elm.focus = () => this.input.focus();
  }

  attached() {
    // reference to the DOM element
    this.domElm = $(this.elm).find('input');

    // Bootstrap 3 & 4 have different class names
    //if tagClass isn't yet configured we will define the tagClass depending on the version
    let pickerOptions = this.options || {};
    if (!this.options.tagClass) {
      pickerOptions.tagClass = this.bootstrapVersion === 3 ? 'label label-info' : 'badge badge-info';
    }

    // create TagsInput
    this.applyExposeEvents();
    this.exposeMethods();

    // finally create the tagsinput with all options
    pickerOptions = Object.assign({}, globalPickerOptions, pickerOptions);
    this.domElm.tagsinput(pickerOptions);

    // expose the element object to the outside
    // this will be useful for calling events/methods/options from the outside
    this.element = {
      events: this.events,
      options: this.options,
      methods: this.methods
    };<commit_msg>fix exception if this.options is null<commit_after>import {inject, bindable, bindingMode, DOM} from 'aurelia-framework';
import $ from 'jquery';
import 'bootstrap-tagsinput/dist/bootstrap-tagsinput';
import {globalExtraOptions, globalPickerOptions} from './picker-global-options';

@inject(Element)
export class AbpTagsInputCustomElement {
  @bindable({defaultBindingMode: bindingMode.twoWay}) element;
  @bindable({defaultBindingMode: bindingMode.twoWay}) value;

  // plugin own variables
  @bindable bootstrapVersion = globalExtraOptions.bootstrapVersion;
  @bindable placeholder = '';

  // picker options
  @bindable options;

  // events (from the View)
  @bindable onBeforeItemAdd;
  @bindable onBeforeItemRemove;
  @bindable onItemAdded;
  @bindable onItemAddedOnInit;
  @bindable onItemRemoved;

  // variables
  events = {};
  methods = {};
  options = {};
  suppressValueChanged;

  constructor(elm) {
    this.elm = elm;

    // ensure the element exposes a "focus" method for Aurelia-Validation
    elm.focus = () => this.input.focus();
  }

  attached() {
    // reference to the DOM element
    this.domElm = $(this.elm).find('input');

    // Bootstrap 3 & 4 have different class names
    //if tagClass isn't yet configured we will define the tagClass depending on the version
    let pickerOptions = this.options || {};
    if (!pickerOptions.tagClass) {
      pickerOptions.tagClass = this.bootstrapVersion === 3 ? 'label label-info' : 'badge badge-info';
    }

    // create TagsInput
    this.applyExposeEvents();
    this.exposeMethods();

    // finally create the tagsinput with all options
    pickerOptions = Object.assign({}, globalPickerOptions, pickerOptions);
    this.domElm.tagsinput(pickerOptions);

    // expose the element object to the outside
    // this will be useful for calling events/methods/options from the outside
    this.element = {
      events: this.events,
      options: pickerOptions,
      methods: this.methods
    };
{'fraction_non_alphanumeric': 0.1104591836734694, 'fraction_numerical': 0.001530612244897959, 'mean_word_length': 3.684587813620072, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7143586', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1096, 'n_words': 311}