diff --git a/developer/js/source/lexical-model-compiler/model-definitions.ts b/developer/js/source/lexical-model-compiler/model-definitions.ts index 4b5b47edf1..a4eca801c7 100644 --- a/developer/js/source/lexical-model-compiler/model-definitions.ts +++ b/developer/js/source/lexical-model-compiler/model-definitions.ts @@ -1,15 +1,15 @@ -import { defaultApplyCasing, - defaultCasedSearchTermToKey, +import { defaultApplyCasing, + defaultCasedSearchTermToKey, defaultSearchTermToKey } from "./model-defaults"; /** * Processes certain defined model behaviors in such a way that the needed closures * may be safely compiled to a JS file and loaded within the LMLayer. - * + * * This is accomplished by writing out a 'pseudoclosure' within the model's IIFE, * then used to build _actual_ closures at LMLayer load time. This 'pseudoclosure' - * will very closely match the organizational patterns of this class in order to + * will very closely match the organizational patterns of this class in order to * facilitate the maintenance of this approach. */ export class ModelDefinitions { @@ -18,10 +18,10 @@ export class ModelDefinitions { * A closure fully implementing the model's defined `applyCasing` behavior with * the function parameter preset to the version-appropriate default. * `defaults.applyCasing` is captured as part of the closure. - * + * * During compilation of some models (such as Trie-based wordlist templated models), * this closure will be directly used as part of searchTermToKey. - * + * * In compiled code, this will instead be defined in-line as an autogenerated closure * using the other properties of the pseudoclosure. */ @@ -34,7 +34,7 @@ export class ModelDefinitions { * * During compilation of some models (such as Trie-based wordlist templated models), * this closure will be directly utilized when compiling the lexicon. - * + * * In compiled code, this will instead be defined in-line as an autogenerated closure * using the other properties of the pseudoclosure. */ @@ -42,7 +42,7 @@ export class ModelDefinitions { /** * Contains embedded 'default' implementations that may be needed for - * closures in the compiled version, annotated with the current version + * closures in the compiled version, annotated with the current version * of Developer. */ private defaults: { @@ -54,7 +54,7 @@ export class ModelDefinitions { /** * Contains the model-specific definitions specified in the model's source. - * + * * These definitions may expect `defaults.applyCasing` as a parameter in * their final closures. */ @@ -95,10 +95,10 @@ export class ModelDefinitions { } else if(modelSource.languageUsesCasing == false) { this.model.searchTermToKey = defaultSearchTermToKey; } else { - // If languageUsesCasing is not defined, then we use pre-14.0 behavior, + // If languageUsesCasing is not defined, then we use pre-14.0 behavior, // which expects a lowercased default. this.model.searchTermToKey = defaultCasedSearchTermToKey; - // Needed to provide pre-14.0 default lowercasing as part of the + // Needed to provide pre-14.0 default lowercasing as part of the // search-term keying operation. this.defaults.applyCasing = defaultApplyCasing; // For compile-time use. @@ -120,18 +120,18 @@ export class ModelDefinitions { /** * Writes out a compiled JS version of the pseudoclosure, preserving all function * implementations. - * + * * This should be written to the file within the same IIFE as the model but BEFORE * the model itself, as the model will need to refer to the definitions herein. */ compileDefinitions(): string { let defn: string = ''; - defn += `let ${PSEUDOCLOSURE} = {\n` + defn += `var ${PSEUDOCLOSURE} = {\n` // ---------------------- // START - the 'defaults', which are common within the same Developer version. defn += ` defaults: {\n version: "${this.defaults.version}"`; - + // Only write out `applyCasing` if and when it is needed. if(this.defaults.applyCasing) { defn += `,\n applyCasing: ${this.defaults.applyCasing.toString()}`; @@ -153,7 +153,7 @@ export class ModelDefinitions { // END - model-specific definitions // ---------------------- - // START - compiled closures. Given those definitions, write out the + // START - compiled closures. Given those definitions, write out the // pseudoclosure-referencing closures for the needed methods. // We should be able to define these closures in-line with the object's @@ -163,7 +163,7 @@ export class ModelDefinitions { if(this.model.applyCasing) { // A major potential issue: if the user wants to call extra custom functions that they've written. // - // `applyCasing` recursion SHOULD be fine if they write `this.applyCasing() and forward all arguments + // `applyCasing` recursion SHOULD be fine if they write `this.applyCasing() and forward all arguments // appropriately, as it will be known as `applyCasing` on the runtime `this` (`model`) object. // // Similarly, as long as any helper functions are similarly compiled and stored as part of `model`,