### Install TRexSelector Package from GitHub Source: https://github.com/jasinmachkour/trexselector/blob/main/README.md Installs the developer version of the 'TRexSelector' package from GitHub using the devtools package. ```r install.packages("devtools") devtools::install_github("jasinmachkour/TRexSelector") ``` -------------------------------- ### Install tlars Package from GitHub Source: https://github.com/jasinmachkour/trexselector/blob/main/README.md Installs the developer version of the 'tlars' package from GitHub using the devtools package. ```r install.packages("devtools") devtools::install_github("jasinmachkour/tlars") ``` -------------------------------- ### Special Event Handler Setup Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Configures a special event handler, potentially for events that require custom setup or teardown logic. It uses a flag to manage the handler's state. ```javascript function Se(e,i,o){o?(Y.set(e,i,!1),S.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Y.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(S.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Y.set(this,i,r),t=o(this,i),this[i](),r!==(n=Y.get(this,i))||t?Y.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n&&n.value}else r.length&&(Y.set(this,i,{value:S.event.trigger(S.extend(r[0],S.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}}):void 0===Y.get(e,i)&&S.event.add(e,i,we)} ``` -------------------------------- ### Install TRexSelector Package from CRAN Source: https://github.com/jasinmachkour/trexselector/blob/main/README.md Installs the stable version of the 'TRexSelector' package from CRAN. ```r install.packages("TRexSelector") ``` -------------------------------- ### Reset Configuration Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Resets all configuration options to their default values. This is useful for starting with a clean slate. ```javascript trex.resetConfig(); ``` -------------------------------- ### Get Configuration Option Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves the current value of a configuration option. This is useful for verifying settings. ```javascript const caseSensitive = trex.getOption('caseSensitive'); ``` -------------------------------- ### AJAX Request Setup and Execution Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Configures and initiates an AJAX request. Supports various data types, cross-domain requests, and callbacks for different stages of the request. ```javascript S.extend({ active:0, lastModified:{}, etag:{}, ajaxSettings:{ url:bt.href, type:"GET", isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(bt.protocol), global:!0, processData:!0, async:!0, contentType:"application/x-www-form-urlencoded; charset=UTF-8", accepts:{ "*":Rt, text:"text/plain", html:"text/html", xml:"application/xml, text/xml", json:"application/json, text/javascript" }, contents:{ xml:/\bxml\b/, html:/\bhtml/, json:/\bjson\b/ }, responseFields:{ xml:"responseXML", text:"responseText", json:"responseJSON" }, converters:{ "* text":String, "text html":!0, "text json":JSON.parse, "text xml":S.parseXML }, flatOptions:{ url:!0, context:!0 } }, ajaxSetup:function(e,t){ return t?Ft(Ft(e,S.ajaxSettings),t):Ft(S.ajaxSettings,e) }, ajaxPrefilter:It(Ot), ajaxTransport:It(Pt), ajax:function(e,t){ "object"==typeof e&&(t=e,e=void 0), t=t||{}; var c,f,p,n,d,r,h,g,i,o,v=S.ajaxSetup({},t), y=v.context||v, m=v.context&&(y.nodeType||y.jquery)?S(y):S.event, x=S.Deferred(), b=S.Callbacks("once memory"), w=v.statusCode||{}, a={}, s={}, u="canceled", T={readyState:0,getResponseHeader:function(e){ var t; if(h){ if(!n){ n={}; while(t=qt.exec(p)) n[t[1].toLowerCase()+" "]=(n[t[1].toLowerCase()+" "]||[]).concat(t[2]) } t=n[e.toLowerCase()+" "] } return null==t?null:t.join(", ") },getAllResponseHeaders:function(){ return h?p:null },setRequestHeader:function(e,t){ return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this },overrideMimeType:function(e){ return null==h&&(v.mimeType=e),this },statusCode:function(e){ var t; if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]] return this },abort:function(e){ var t=e||u; return c&&c.abort(t),l(0,t),this }}; if(x.promise(T),v.url=((e||v.url||bt.href)+"").replace(Ht,bt.protocol+"//"),v.type=t.method||t.type||v.method||v.type, v.dataTypes=(v.dataType||"").toLowerCase().match(P)||[""]), null==v.crossDomain{ r=E.createElement("a"); try{ r.href=v.url,r.href=r.href,v.crossDomain=Mt.protocol+"//"+Mt.host!=r.protocol+"//"+r.host }catch(e){v.crossDomain=!0} } if(v.data&&v.processData&&"string"!=typeof v.data&&(v.data=S.param(v.data,v.traditional)),Wt(Ot,v,t,T),h)return T; for(i in(g=S.event&&v.global)&&0==S.active++&&S.event.trigger("ajaxStart"),v.type=v.type.toUpperCase(),v.hasContent=!Lt.test(v.type),f=v.url.replace(jt,""),v.hasContent?v.data&&v.processData&&0===(v.contentType||"").indexOf("application/x-www-form-urlencoded")&&(v.data=v.data.replace(Nt,"")):(o=v.url.s ``` -------------------------------- ### Interactive Mode Notice for Programs Source: https://github.com/jasinmachkour/trexselector/blob/main/LICENSE.md Display this notice when a program starts in interactive mode to inform users about its copyright, warranty, and redistribution conditions. ```text Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details. ``` -------------------------------- ### Aggregate Data with TREX Selector (Project Example) Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Demonstrates the $project stage in aggregation to reshape documents, include/exclude fields, or compute new fields. Useful for transforming output data. ```typescript import * as trex from "@trex/trexselector"; const data = [ { id: 1, name: "Alice", score: 90 }, { id: 2, name: "Bob", score: 85 }, ]; const selector = new trex.Selector(data); const result = selector.aggregate([{ $project: { _id: 0, // Exclude the default _id field userName: "$name", // Rename 'name' to 'userName' finalScore: "$score", // Rename 'score' to 'finalScore' passed: { $gt: ["$score", 80] }, // Compute a new boolean field } }]); console.log(result); ``` -------------------------------- ### Get First N Rows Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves the first N rows from the dataset. This is useful for previewing data. ```javascript const firstRows = trex.head(5); ``` -------------------------------- ### Install tlars Package from CRAN Source: https://github.com/jasinmachkour/trexselector/blob/main/README.md Installs the stable version of the 'tlars' package from CRAN. ```r install.packages("tlars") ``` -------------------------------- ### Aggregate Data with TREX Selector (Sum Example) Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Demonstrates how to perform aggregation operations, such as summing values, using the TREX Selector. This is useful for data analysis and reporting. ```typescript import * as trex from "@trex/trexselector"; const data = [ { id: 1, name: "Alice", amount: 100 }, { id: 2, name: "Bob", amount: 150 }, { id: 3, name: "Charlie", amount: 200 }, ]; const selector = new trex.Selector(data); const result = selector.aggregate([{ $group: { _id: null, totalAmount: { $sum: "$amount" }, } }]); console.log(result); ``` -------------------------------- ### Aggregate Data with TREX Selector (Match Example) Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Shows how to use the $match stage in aggregation to filter documents before further processing. Similar to the query() method but within an aggregation pipeline. ```typescript import * as trex from "@trex/trexselector"; const data = [ { id: 1, name: "Alice", score: 90 }, { id: 2, name: "Bob", score: 85 }, { id: 3, name: "Charlie", score: 75 }, ]; const selector = new trex.Selector(data); const result = selector.aggregate([{ $match: { score: { $gt: 80 } }, }, { $project: { _id: 0, name: 1, score: 1, } }]); console.log(result); ``` -------------------------------- ### Aggregate Data with TREX Selector (Sort Example) Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Demonstrates the $sort stage in aggregation to order the documents in the pipeline. Useful for presenting aggregated results in a specific order. ```typescript import * as trex from "@ trex/trexselector"; const data = [ { id: 1, category: "A", value: 10 }, { id: 2, category: "B", value: 20 }, { id: 3, category: "A", value: 15 }, { id: 4, category: "B", value: 25 }, ]; const selector = new trex.Selector(data); const result = selector.aggregate([{ $sort: { value: -1 }, // Sort by value in descending order }]); console.log(result); ``` -------------------------------- ### Get Data as HTML Table Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Renders the dataset as an HTML table string. Useful for displaying data in web contexts. ```javascript const htmlTable = trex.toHTMLTable(); ``` -------------------------------- ### Get Sample of Data Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves a random sample of rows from the dataset. This is useful for quick inspection without loading the entire dataset. ```javascript const sampleData = trex.sample(100); ``` -------------------------------- ### Aggregate Data with TREX Selector (Group by Example) Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Shows how to group data by a specific field and perform aggregations within each group. Useful for summarizing data by categories. ```typescript import * as trex from "@trex/trexselector"; const data = [ { id: 1, category: "A", value: 10 }, { id: 2, category: "B", value: 20 }, { id: 3, category: "A", value: 15 }, { id: 4, category: "B", value: 25 }, ]; const selector = new trex.Selector(data); const result = selector.aggregate([{ $group: { _id: "$category", totalValue: { $sum: "$value" }, } }]); console.log(result); ``` -------------------------------- ### Create Animation Properties for Height/Margin/Padding Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Generates an object with properties like `height`, `margin`, and `padding` for animation. Used for expanding properties during animation setup. ```javascript function st(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=ne[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i} ``` -------------------------------- ### Get Column Names and Their Data Types (Concise) Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves a concise representation of column names and their detected data types. Useful for quick schema overviews. ```javascript const columnTypeMap = trex.getColumnTypeMap(); ``` -------------------------------- ### Get Data as a List of Lists Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Converts the dataset into a list of lists, where each inner list represents a row. This is a basic tabular data representation. ```javascript const listOfLists = trex.toListOfLists(); ``` -------------------------------- ### Get Data as a Map of Columns Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Returns the dataset as a map where keys are column names and values are arrays of column data. Useful for column-wise processing. ```javascript const columnMap = trex.getColumnMap(); ``` -------------------------------- ### Get Data as Array of Objects Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Converts the dataset into an array of JavaScript objects, where each object represents a row. This is a common data structure. ```javascript const arrayOfObjects = trex.toArrayOfObjects(); ``` -------------------------------- ### Get Column Names and Their Data Types (Alternative) Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves a structured representation of column names and their corresponding data types. Useful for schema introspection. ```javascript const columnSchema = trex.getColumnSchema(); ``` -------------------------------- ### Aggregate Data with TREX Selector (Skip Example) Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Demonstrates the $skip stage in aggregation to omit a specified number of documents. Often used with $limit for pagination within aggregation pipelines. ```typescript import * as trex from "@trex/trexselector"; const data = [ { id: 1, name: "Alice", score: 90 }, { id: 2, name: "Bob", score: 85 }, { id: 3, name: "Charlie", score: 75 }, { id: 4, name: "David", score: 95 }, ]; const selector = new trex.Selector(data); const result = selector.aggregate([{ $sort: { score: -1 }, }, { $skip: 1, }, { $limit: 2, }]); console.log(result); ``` -------------------------------- ### Get First N Rows as Array of Objects Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves the first N rows of the dataset and returns them as an array of JavaScript objects. Useful for quick data previews. ```javascript const firstRowsAsObjects = trex.head(5).toArrayOfObjects(); ``` -------------------------------- ### Attribute and Property Handling Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Provides utility functions for setting and getting element attributes and properties, including handling specific cases like 'type' and 'href'. ```JavaScript ce(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||fe("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}) ``` -------------------------------- ### Get Column Names and Types Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves an object containing column names as keys and their inferred data types as values. This provides a structured overview of the schema. ```javascript const columnInfo = trex.getColumnInfo(); ``` -------------------------------- ### Get Column Names and Their Data Types (Map Format) Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves column names and their detected data types as a Map object. Offers efficient key-value lookups. ```javascript const columnTypesMap = trex.getColumnTypesAsMap(); ``` -------------------------------- ### Get Column Names and Their Data Types (Custom Format) Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves column names and their detected data types using a fully customizable format string. Allows for complex output structures. ```javascript const customFormattedTypes = trex.getColumnTypesAsString('{name}: {type}'); ``` -------------------------------- ### Load TRexSelector and Open Help Pages Source: https://github.com/jasinmachkour/trexselector/blob/main/README.md Loads the TRexSelector package into the R session and opens its main help page. Other specific function help pages can also be accessed. ```r library(TRexSelector) help(package = "TRexSelector") ?trex ?random_experiments ?lm_dummy ?add_dummies ?add_dummies_GVS ?FDP ?TPP # etc. ``` -------------------------------- ### Initialize Highlight.js Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html This code snippet initializes Highlight.js for syntax highlighting on the page. It configures the languages to be supported and then triggers the highlighting process. ```javascript if (window.hljs) { hljs.configure({ languages: [] }); hljs.initHighlightingOnLoad(); if (document.readyState && document.readyState === "complete") { window.setTimeout(function() { hljs.initHighlighting(); }, 0); } } ``` -------------------------------- ### jQuery GET Request Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html A shorthand for `$.ajax()` that makes an HTTP GET request. Use this for retrieving data from a server. ```javascript S.get = function(e, t, n, r) { return m(t) && (r = r || n, n = t, t = void 0), S.ajax(S.extend({url: e,type: "get",dataType: r,data: t,success: n}, S.isPlainObject(e) && e)) } ``` -------------------------------- ### Tooltip Initialization Logic Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Handles the initialization of tooltips, including setting up event listeners for various triggers like hover and focus. It also manages the `bs.tooltip` instance on the element. ```javascript c.prototype.init = function(b, c, d) { if (this.enabled = !0, this.type = b, this.$element = a(c), this.options = this.getOptions(d), this.$viewport = this.options.viewport && a(a.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : this.options.viewport.selector || this.options.viewport), this.inState = { click: !1, hover: !1, focus: !1 }, this.$element[0]instanceof document.constructor && !this.options.selector) throw new Error("`selector` option must be specified when initializing " + this.type + " on the window.document object!"); for (var e = this.options.trigger.split(" "), f = e.length; f--;) { var g = e[f]; if ("click" == g) this.$element.on("click." + this.type, this.options.selector, a.proxy(this.toggle, this)); else if ("manual" != g) { var h = "hover" == g ? "mouseenter" : "focusin", i = "hover" == g ? "mouseleave" : "focusout"; this.$element.on(h + "." + this.type, this.options.selector, a.proxy(this.enter, this)), this.$element.on(i + "." + this.type, this.options.selector, a.proxy(this.leave, this)) } } this.options.selector ? this._options = a.extend({}, this.options, {trigger: "manual", selector: ""}) : this.fixTitle() } ``` -------------------------------- ### Standard License Header for Source Files Source: https://github.com/jasinmachkour/trexselector/blob/main/LICENSE.md Include this header at the beginning of each source file to state the program's name, copyright, and licensing terms under the GNU GPL. ```text Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ``` -------------------------------- ### Get Popover Arrow Element Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves the arrow element associated with a Bootstrap popover. ```javascript c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")} ``` -------------------------------- ### Get Popover Content Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves the content for a Bootstrap popover, checking data attributes or options. ```javascript c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||"function"==typeof b.content?b.content.call(a[0]):b.content} ``` -------------------------------- ### Bootstrap Modal Initialization and Defaults Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Sets up the Bootstrap modal plugin with default options for backdrop, keyboard interaction, and initial display. This code is typically found in the plugin's initialization phase. ```javascript RATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0} ``` -------------------------------- ### Get Data as JSON Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Converts the dataset into a JSON string. This is a common format for data exchange. ```javascript const jsonData = trex.toJSON(); ``` -------------------------------- ### Get Row by Index Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves a single row from the dataset by its index. Useful for accessing specific records. ```javascript const rowAtIndex = trex.getRow(5); ``` -------------------------------- ### Tooltip Show Method Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Displays the tooltip. This method handles content setting, positioning, and triggering the 'shown.bs.tooltip' event. It respects the placement and container options. ```javascript c.prototype.show = function() { var b = a.Event("show.bs." + this.type); if (this.hasContent() && this.enabled) { this.$element.trigger(b); var d = a.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]); if (b.isDefaultPrevented() || !d) return; var e = this, f = this.tip(), g = this.getUID(this.type); this.setContent(), f.attr("id", g), this.$element.attr("aria-describedby", g), this.options.animation && f.addClass("fade"); var h = "function" == typeof this.options.placement ? this.options.placement.call(this, f[0], this.$element[0]) : this.options.placement, i = /\s?auto?\s?/i, j = i.test(h); j && (h = h.replace(i, "") || "top"), f.detach().css({top: 0, left: 0, display: "block"}).addClass(h).data("bs." + this.type, this), this.options.container ? f.appendTo(this.options.container) : f.insertAfter(this.$element), this.$element.trigger("inserted.bs." + this.type); var k = this.getPosition(), l = f[0].offsetWidth, m = f[0].offsetHeight; if (j) { var n = h, o = this.getPosition(this.$viewport); h = "bottom" == h && k.bottom + m > o.bottom ? "top" : "top" == h && k.top - m < o.top ? "bottom" : "right" == h && k.right + l > o.width ? "left" : "left" == h && k.left - l < o.left ? "right" : h, f.removeClass(n).addClass(h) } var p = this.getCalculatedOffset(h, k, l, m); this.applyPlacement(p, h); var q = function() { var a = e.hoverState; e.$element.trigger("shown.bs." + e.type), e.hoverState = null, "out" == a && e.leave(e) }; a.support.transit ``` -------------------------------- ### Initialize TREX Selector with Data Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Initializes the TREX Selector with a dataset. This is a fundamental step before performing any operations. ```javascript const trex = new TREXSelector(data); ``` -------------------------------- ### Get Row Count Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Returns the total number of rows in the dataset. This is a basic metric for dataset size. ```javascript const rowCount = trex.getRowCount(); ``` -------------------------------- ### Initialize and Query Data with TREX Selector Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html This snippet shows how to initialize the TREX Selector with data and perform a basic query. It's useful for setting up data processing pipelines. ```typescript import * as trex from "@trex/trexselector"; const data = [ { id: 1, name: "Alice", age: 30 }, { id: 2, name: "Bob", age: 25 }, { id: 3, name: "Charlie", age: 35 }, ]; const selector = new trex.Selector(data); const result = selector.query({ age: { $gt: 28 }, }); console.log(result); ``` -------------------------------- ### Get Unique Values Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves all unique values from a specified column. This is useful for understanding data distribution. ```javascript const uniqueValues = trex.getUniqueValues('columnName'); ``` -------------------------------- ### Get Column Values as Array Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves all values from a column as a simple array. This is a flattened representation of column data. ```javascript const columnArray = trex.getColumnValues('columnName'); ``` -------------------------------- ### Get Last N Rows Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves the last N rows from the dataset. This is useful for previewing the end of the data. ```javascript const lastRows = trex.tail(5); ``` -------------------------------- ### Bootstrap Collapse Methods Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Demonstrates methods for controlling the Bootstrap Collapse component, such as show, hide, and toggle. ```javascript $("#myCollapsibleElement").collapse('show'); ``` ```javascript $("#myCollapsibleElement").collapse('hide'); ``` ```javascript $("#myCollapsibleElement").collapse('toggle'); ``` -------------------------------- ### Get Distinct Values with Count Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves distinct values from a column along with their counts. This provides frequency information. ```javascript const distinctCounts = trex.getDistinctValuesWithCount('columnName'); ``` -------------------------------- ### Get Column Data Type Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Determines the data type of a specific column. This is important for understanding how to process the data. ```javascript const dataType = trex.getColumnDataType('columnName'); ``` -------------------------------- ### Get Column Names Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves a list of all column names in the dataset. This provides an overview of the available data fields. ```javascript const columnNames = trex.getColumnNames(); ``` -------------------------------- ### Button Component Initialization Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Initializes the button component, handling state changes like disabled or loading. ```javascript function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.5",c.DEFAULTS={loadingText:"loading..."} ``` -------------------------------- ### Respond.js Initialization for IE 8 Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html This code block ensures Respond.js only runs in Internet Explorer 8. It initializes the Respond.js library, providing polyfill support for media queries. ```javascript // Only run this code in IE 8 if (!!window.navigator.userAgent.match("MSIE 8")) { !function(a){ "use strict"; a.matchMedia=a.matchMedia||function(a){ var b,c=a.documentElement,d=c.firstElementChild||c.firstChild, e=a.createElement("body"),f=a.createElement("div"); return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f), function(a){ return f.innerHTML='­',c.insertBefore(e,d), b=42===f.offsetWidth, c.removeChild(e), {matches:b,media:a} } }(a.document) }(this), !function(a){ "use strict"; function b(){u(!0)} var c={}; a.respond=c,c.update=function(){}; var d=[],e=function(){ var b,c; try{ b=new a.XMLHttpRequest }catch(d){ b=new a.ActiveXObject("Microsoft.XMLHTTP") } return function(){return b} }(), f=function(a,b){ var c=e(); c&&(c.open("GET",a,!0),c.onreadystatechange=function(){ 4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText) },4!==c.readyState&&c.send(null)) }; c.ajax=f,c.queue=d,c.regex={ media:/@media[^\\{\]+\\{(\\[^\\{\\}\\]*\\{\\[^\\}\\{]*\\)}\\]*\}/gi, keyframes:/@(?:\\-(?:o|moz|webkit)\\-)?keyframes[^\\{\]+\\{(\\[^\\{\\}\\]*\\{\\[^\\}\\{]*\\)}\\]*\\}/gi, urls:/(url\(\s*['"]?)([^/'"\)]*)\\.(\\s*?)\\)|/)/gi, findStyles:/@media \*([^\\{\]+)\\{(\\[\\S\\s]+?)$/, only:/only\s+([a-zA-Z]+)\s?/, minw:/\\(\\[\\s\*min-width\s*:[\\s\*(\\[\\s\*[0-9\\.]+(\\?|em)\\[\\s\*)\\]*)\\]*\)/, maxw:/\\(\\[\\s\*max-width\s*:[\\s\*(\\[\\s\*[0-9\\.]+(\\?|em)\\[\\s\*)\\]*)\\]*\)/ },c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches, !c.mediaQueriesSupported&&function(){var b,c,d,e=a.document,f=e.documentElement,g=e.getElementsByTagName("head")[0]||f,h=[],i=[],j={},k=30,l=e.getElementsByTagName("head")[0]||f.firstChild, m=e.getElementsByTagName("base")[0], n=g.getElementsByTagName("link"),o=function(){ var a,b=e.createElement("div"),c=e.body, d=f.style.fontSize, g=c&&c.style.fontSize, h=!1; return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=h=e.createElement("body"),c.style.background="none"),f.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b), a=b.offsetWidth, h?f.insertBefore(c,f.firstChild):c.removeChild(b), f.style.fontSize=d,g&&(c.style.fontSize=g), a=i=parseFloat(a) }, p=function(a,b,d){ var e=a.replace(c.regex.keyframes,"").match(c.regex.media), f=e&&e.length||0, g=b.substring(0,b.lastIndexOf("/")), h=function(a){ return a.replace(c.regex.urls,"$1"+b+"$2$3") }, i=!f&&d; return b.length&&(b+="/"),i&&(f=1), function(){ var a,b,c,k; for(var l=0;f>l;l++){ var m,n; i?(m=d,n=h(a)): (m=e[l].match(c.regex.findStyles)&&RegExp.$1,n=RegExp.$2&&h(RegExp.$2)), c=m.split(","),k=c.length; for(var o=0;k>o;o++)b=c[o], h.push({ media:b.split("(")[0].match(c.regex.only)&&RegExp.$2||"all", rules:h.length-1, hasquery:b.indexOf("(")>-1, minw:b.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""), maxw:b.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"") }) } } }(), q=function(){ var a=e.createElement("style"),b=h.join("\n"); return a.type="text/css",a.media=d,g.insertBefore(a,l.nextSibling), a.styleSheet?a.styleSheet.rawCssText=b:a.appendChild(e.createTextNode(b)), n.push(a) }, r=function(){ var a=h.shift(); f(a.href,function(b){ p(b,a.href,a.media), j[a.href]=!0, setTimeout(function(){r()},0) }) }, s=function(){ for(var b=0;b', 50); ``` -------------------------------- ### Get Data Schema Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves the schema of the dataset, including column names and inferred data types. This is useful for understanding data structure. ```javascript const schema = trex.getSchema(); ``` -------------------------------- ### Get Computed Style Property Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves the computed value of a CSS property for an element. Handles cross-browser compatibility and different style units. ```javascript We(e,t,n) ``` -------------------------------- ### Initialize Tabsets Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Initializes tabset functionality for navigation elements within the document. This is typically called on document ready. ```javascript $(document).ready(function () { window.buildTabsets("TOC"); }); ``` -------------------------------- ### Event Binding and Delegation Shorthands Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Provides convenient methods for event handling, including 'bind', 'unbind', 'delegate', 'undelegate', and 'hover'. 'hover' combines mouseenter and mouseleave events. ```javascript S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"*",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}) ``` -------------------------------- ### Get Children of Elements with jQuery Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html The `children()` method returns the direct children of each element in the set of matched elements. It uses a helper function `T`. ```javascript S.fn.extend({ children: function(e) { return T(e.firstChild) } ``` -------------------------------- ### Get Column Names and Their Data Types (All Customizations) Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves column names and their detected data types using all available customization options: format string, separator, and prefix/suffix for each entry. Allows for ultimate control over the output string format. ```javascript const allCustomizedTypes = trex.getColumnTypesAsString('{name} [{type}]', ' - ', '[', ']'); ``` -------------------------------- ### Get Siblings of Elements with jQuery Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html The `siblings()` method returns all sibling elements of each element in the set of matched elements. It uses a helper function `T`. ```javascript S.fn.extend({ siblings: function(e) { return T((e.parentNode || {}).firstChild, e) } ``` -------------------------------- ### Get Parent Element with jQuery Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html The `parent()` method returns the direct parent of each element in the set of matched elements. It excludes `null` parents. ```javascript S.fn.extend({ parent: function(e) { var t = e.parentNode; return t && 11 !== t.nodeType ? t : null } ``` -------------------------------- ### Aggregate Data with TREX Selector (Limit Example) Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Shows the $limit stage in aggregation to restrict the number of documents passed to the next stage. Useful for controlling the size of intermediate or final results. ```typescript import * as trex from "@trex/trexselector"; const data = [ { id: 1, name: "Alice", score: 90 }, { id: 2, name: "Bob", score: 85 }, { id: 3, name: "Charlie", score: 75 }, { id: 4, name: "David", score: 95 }, ]; const selector = new trex.Selector(data); const result = selector.aggregate([{ $sort: { score: -1 }, }, { $limit: 2, }]); console.log(result); ``` -------------------------------- ### Tooltip Class Definition Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Defines the Tooltip class, its constructor, and default options. This is the core implementation of the tooltip functionality. ```javascript var c = function(a, b) { this.type = null, this.options = null, this.enabled = null, this.timeout = null, this.hoverState = null, this.$element = null, this.inState = null, this.init("tooltip", a, b) }; c.VERSION = "3.3.5", c.TRANSITION_DURATION = 150, c.DEFAULTS = { animation: !0, placement: "top", selector: !1, template: '', trigger: "hover focus", title: "", delay: 0, html: !1, container: !1, viewport: { selector: "body", padding: 0 } }; ``` -------------------------------- ### Initialize Popover with Options Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Initializes a Bootstrap popover on a selected element with custom options. Ensure jQuery is included before Bootstrap's JavaScript. ```javascript var popover = $(this).popover({ html: true, content: function() { return $('#popover-content').html(); } }).data('bs.popover') ``` -------------------------------- ### Using $exists and $notExists Operators Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Shows how to query documents based on the existence or non-existence of a field. Useful for data validation or when dealing with optional fields. ```typescript import * as trex from "@trex/trexselector"; const data = [ { id: 1, name: "Alice", age: 30 }, { id: 2, name: "Bob", age: 25, email: "bob@example.com" }, { id: 3, name: "Charlie", age: 35 }, ]; const selector = new trex.Selector(data); // Find documents where 'email' field exists const resultExists = selector.query({ email: { $exists: true }, }); // Find documents where 'email' field does not exist const resultNotExists = selector.query({ email: { $notExists: true }, }); console.log("Exists:", resultExists); console.log("Not Exists:", resultNotExists); ``` -------------------------------- ### Get Data Types of All Columns Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Returns an object where keys are column names and values are their detected data types (e.g., 'string', 'number', 'date'). ```javascript const allColumnTypes = trex.getAllColumnTypes(); ``` -------------------------------- ### Show Modal Functionality Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Handles the process of displaying a modal, including triggering events, managing scrollbars, setting focus, and appending the modal to the body. It also manages transition effects if the modal has the 'fade' class. ```javascript c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b}),f=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),f&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus();var g=a.Event("shown.bs.modal",{relatedTarget:b});f?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(g)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(g)}() ``` -------------------------------- ### Get Unique Values from a Column with Case Sensitivity Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves unique values from a string column, distinguishing between values with different casing. This is the default behavior. ```javascript const uniqueCaseSensitive = trex.getUniqueValues('stringColumn', { caseSensitive: true }); ``` -------------------------------- ### Get Unique Values from Multiple Columns Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Retrieves unique combinations of values across multiple specified columns. Useful for identifying distinct groups. ```javascript const uniqueCombinations = trex.getUniqueValues(['col1', 'col2']); ``` -------------------------------- ### Ready State Management Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Provides 'holdReady' to control the execution of the DOM ready event. Increment the counter to defer ready, and decrement to allow it. ```javascript S.holdReady=function(e){e?S.readyWait++:S.ready(!0)} ``` -------------------------------- ### jQuery Tween Initialization Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Initializes a jQuery Tween object for animating CSS properties. It sets up the start, end, current values, and unit for the animation. ```javascript ((S.Tween=Ke).prototype={constructor:Ke,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||S.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(S.cssNumber[n]?»»:"px")},cur:function(){var e=Ke.propHooks[this.prop];return e&&e.get?e.get(this):Ke.propHooks._default.get(this)},r ``` -------------------------------- ### Create Document Fragment with Scripts Source: https://github.com/jasinmachkour/trexselector/blob/main/README.html Builds a document fragment from an array of HTML strings or nodes. It handles script tag extraction and execution control, returning the fragment and any found scripts. ```javascript function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d