<commit_before>/// <reference path="../app.module.ts" />

module ap {
    'use strict';

    var $q: ng.IQService, apUtilityService: UtilityService;

    export interface ILookup {
        lookupValue: string;
        lookupId: number;
    }

    /**
     * @ngdoc function
     * @name Lookup
     * @description
     * Allows for easier distinction when debugging if object type is shown as either Lookup or User.  Also allows us
     * to create an async request for the entity being referenced by the lookup
     * @param {string} s String to split into lookupValue and lookupId
     * @param {object} options Contains a reference to the parent list item and the property name.
     * @param {object} options.entity Reference to parent list item.
     * @param {object} options.propertyName Key on list item object.
     * @constructor
     */
    export class Lookup implements ILookup{
        lookupId:number;
        lookupValue:string;

        constructor(s, options) {
            var lookup = this;
            var thisLookup = new apUtilityService.SplitIndex(s);
            lookup.lookupId = thisLookup.id;
            lookup.lookupValue = thisLookup.value || '';
        }
    }


    export class LookupFactory {
        Lookup = Lookup;
        static $inject = ['$q', 'apUtilityService'];
        constructor(_$q_, _apUtilityService_) {
            $q = _$q_;
            apUtilityService = _apUtilityService_;
        }

        /**
         * @ngdoc function
         * @name angularPoint.apLookupFactory:create
         * @methodOf angularPoint.apLookupFactory
         * @description
         * Instantiates and returns a new Lookup field.
         */
        create(s, options) {
            return new Lookup(s, options);
        }
    }

    /**
     * @ngdoc function
     * @name angularPoint.apLookupFactory
     * @description
     * Tools to assist with the creation of CAML queries.
     *
     */
    angular.module('angularPoint')
        .service('apLookupFactory', LookupFactory);


}<commit_msg>Added type to ILookup Interface in order to better specify what type of ListItem the lookup is referencing.<commit_after>/// <reference path="../app.module.ts" />

module ap {
    'use strict';

    var $q: ng.IQService, apUtilityService: UtilityService;

    /** Lookup referencing a ListItem of the specified type.  The "lookupId""
     * will be the same as the referenced <T>.id.  The "lookupValue"" by default
     * should be the <T>.title but it can be changed to another text field
     * in the SharePoint list settings for this list. Only the lookupValue is
     * required and will be sent to the server when saving.  The lookupValue is
     * ignored.  */
    export interface ILookup<T> {
        lookupValue: string;
        lookupId: number;
    }

    /**
     * @ngdoc function
     * @name Lookup
     * @description
     * Allows for easier distinction when debugging if object type is shown as either Lookup or User.  Also allows us
     * to create an async request for the entity being referenced by the lookup
     * @param {string} s String to split into lookupValue and lookupId
     * @param {object} options Contains a reference to the parent list item and the property name.
     * @param {object} options.entity Reference to parent list item.
     * @param {object} options.propertyName Key on list item object.
     * @constructor
     */
    export class Lookup<T> implements ILookup<T> {
        lookupId: number;
        lookupValue: string;

        constructor(s, options) {
            var lookup = this;
            var thisLookup = new apUtilityService.SplitIndex(s);
            lookup.lookupId = thisLookup.id;
            lookup.lookupValue = thisLookup.value || '';
        }
    }


    export class LookupFactory {
        static $inject = ['$q', 'apUtilityService'];
        Lookup = Lookup;

        constructor(_$q_, _apUtilityService_) {
            $q = _$q_;
            apUtilityService = _apUtilityService_;
        }

        /**
         * @ngdoc function
         * @name angularPoint.apLookupFactory:create
         * @methodOf angularPoint.apLookupFactory
         * @description
         * Instantiates and returns a new Lookup field.
         */
        create<T>(s, options) {
            return new Lookup<T>(s, options);
        }
    }

    /**
     * @ngdoc function
     * @name angularPoint.apLookupFactory
     * @description
     * Tools to assist with the creation of CAML queries.
     *
     */
    angular.module('angularPoint')
        .service('apLookupFactory', LookupFactory);


}
{'fraction_non_alphanumeric': 0.08763897972531066, 'fraction_numerical': 0.0, 'mean_word_length': 2.2287121745249823, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, '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': '3376269', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1208, 'n_words': 420}