2021-05-10 20:56:20 +02:00
<!doctype html>
< html class = "no-js" lang = "" >
< head >
< meta charset = "utf-8" >
< meta http-equiv = "x-ua-compatible" content = "ie=edge" >
< title > CICADA< / title >
< meta name = "description" content = "" >
< meta name = "viewport" content = "width=device-width, initial-scale=1" >
< link rel = "icon" type = "image/x-icon" href = "../images/favicon.ico" >
< link rel = "stylesheet" href = "../styles/style.css" >
< / head >
< body >
< div class = "navbar navbar-default navbar-fixed-top visible-xs" >
< a href = "../" class = "navbar-brand" > CICADA< / a >
< button type = "button" class = "btn btn-default btn-menu ion-ios-menu" id = "btn-menu" > < / button >
< / div >
< div class = "xs-menu menu" id = "mobile-menu" >
< div id = "book-search-input" role = "search" > < input type = "text" placeholder = "Type to search" > < / div > < compodoc-menu > < / compodoc-menu >
< / div >
< div class = "container-fluid main" >
< div class = "row main" >
< div class = "hidden-xs menu" >
< compodoc-menu mode = "normal" > < / compodoc-menu >
< / div >
<!-- START CONTENT -->
< div class = "content miscellaneous-functions" >
< div class = "content-data" >
< ol class = "breadcrumb" >
< li > Miscellaneous< / li >
< li > Functions< / li >
< / ol >
< section >
< h3 id = "index" > Index< / h3 >
< table class = "table table-sm table-bordered index-table" >
< tbody >
< tr >
< td class = "col-md-4" >
< ul class = "index-list" >
< li >
< a href = "#arraySum" title = "src/app/_helpers/array-sum.ts" > < b > arraySum< / b > (src/.../array-sum.ts)< / a >
< / li >
< li >
< a href = "#copyToClipboard" title = "src/app/_helpers/clipboard-copy.ts" > < b > copyToClipboard< / b > (src/.../clipboard-copy.ts)< / a >
< / li >
< li >
< a href = "#exportCsv" title = "src/app/_helpers/export-csv.ts" > < b > exportCsv< / b > (src/.../export-csv.ts)< / a >
< / li >
< li >
< a href = "#HttpGetter" title = "src/app/_helpers/http-getter.ts" > < b > HttpGetter< / b > (src/.../http-getter.ts)< / a >
< / li >
< li >
< a href = "#parseData" title = "src/app/_helpers/read-csv.ts" > < b > parseData< / b > (src/.../read-csv.ts)< / a >
< / li >
< li >
< a href = "#personValidation" title = "src/app/_helpers/schema-validation.ts" > < b > personValidation< / b > (src/.../schema-validation.ts)< / a >
< / li >
< li >
< a href = "#readCsv" title = "src/app/_helpers/read-csv.ts" > < b > readCsv< / b > (src/.../read-csv.ts)< / a >
< / li >
< li >
< a href = "#vcardValidation" title = "src/app/_helpers/schema-validation.ts" > < b > vcardValidation< / b > (src/.../schema-validation.ts)< / a >
< / li >
< / ul >
< / td >
< / tr >
< / tbody >
< / table >
< / section >
< h3 > src/app/_helpers/array-sum.ts< / h3 >
< section >
< h3 > < / h3 > < table class = "table table-sm table-bordered" >
< tbody >
< tr >
< td class = "col-md-4" >
< a name = "arraySum" > < / a >
< span class = "name" >
< b >
arraySum
< / b >
< a href = "#arraySum" > < span class = "icon ion-ios-link" > < / span > < / a >
< / span >
< / td >
< / tr >
< tr >
< td class = "col-md-4" >
< code > arraySum(arr)< / code >
< / td >
< / tr >
< tr >
< td class = "col-md-4" >
2021-05-11 13:34:23 +02:00
< div class = "io-description" > < p > Returns the sum of all values in an array.< / p >
< / div >
2021-05-10 20:56:20 +02:00
< div class = "io-description" >
< b > Parameters :< / b >
< table class = "params" >
< thead >
< tr >
< td > Name< / td >
< td > Optional< / td >
2021-05-11 13:34:23 +02:00
< td > Description< / td >
2021-05-10 20:56:20 +02:00
< / tr >
< / thead >
< tbody >
< tr >
< td > arr< / td >
< td >
No
< / td >
2021-05-11 13:34:23 +02:00
< td >
< ul >
< li > An array of numbers.< / li >
< / ul >
< / td >
2021-05-10 20:56:20 +02:00
< / tr >
< / tbody >
< / table >
< / div >
< div >
2021-05-11 13:34:23 +02:00
< b > Example :< / b >
< div >
< pre class = "line-numbers" > < code class = "language-html" > Prints 6 for the array [1, 2, 3]:< /p>
< p> ```typescript< /p>
< ul>
< li> console.log(arraySum([1, 2, 3]));< /li>
< li> ```< /li>
< /ul> < / code > < / pre >
< / div >
2021-05-10 20:56:20 +02:00
< / div >
< div class = "io-description" >
< b > Returns : < / b > < code > < a href = "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target = "_blank" > number< / a > < / code >
< / div >
< div class = "io-description" >
2021-05-11 13:34:23 +02:00
< p > The sum of all values in the array.< / p >
2021-05-10 20:56:20 +02:00
< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / section > < h3 > src/app/_helpers/clipboard-copy.ts< / h3 >
< section >
< h3 > < / h3 > < table class = "table table-sm table-bordered" >
< tbody >
< tr >
< td class = "col-md-4" >
< a name = "copyToClipboard" > < / a >
< span class = "name" >
< b >
copyToClipboard
< / b >
< a href = "#copyToClipboard" > < span class = "icon ion-ios-link" > < / span > < / a >
< / span >
< / td >
< / tr >
< tr >
< td class = "col-md-4" >
< code > copyToClipboard(text: < a href = "https://www.typescriptlang.org/docs/handbook/basic-types.html" target = "_blank" > any< / a > )< / code >
< / td >
< / tr >
< tr >
< td class = "col-md-4" >
2021-05-11 13:34:23 +02:00
< div class = "io-description" > < p > Copies set text to clipboard.< / p >
< / div >
2021-05-10 20:56:20 +02:00
< div class = "io-description" >
< b > Parameters :< / b >
< table class = "params" >
< thead >
< tr >
< td > Name< / td >
< td > Type< / td >
< td > Optional< / td >
2021-05-11 13:34:23 +02:00
< td > Description< / td >
2021-05-10 20:56:20 +02:00
< / tr >
< / thead >
< tbody >
< tr >
< td > text< / td >
< td >
< code > < a href = "https://www.typescriptlang.org/docs/handbook/basic-types.html" target = "_blank" > any< / a > < / code >
< / td >
< td >
No
< / td >
2021-05-11 13:34:23 +02:00
< td >
< ul >
< li > The text to be copied to the clipboard.< / li >
< / ul >
< / td >
2021-05-10 20:56:20 +02:00
< / tr >
< / tbody >
< / table >
< / div >
< div >
2021-05-11 13:34:23 +02:00
< b > Example :< / b >
< div >
< pre class = "line-numbers" > < code class = "language-html" > copies & #39;Hello World!& #39; to the clipboard and prints & quot;true& quot;:< /p>
< p> ```typescript< /p>
< ul>
< li> console.log(copyToClipboard(& #39;Hello World!& #39;));< /li>
< li> ```< /li>
< /ul> < / code > < / pre >
< / div >
2021-05-10 20:56:20 +02:00
< / div >
< div class = "io-description" >
< b > Returns : < / b > < code > < a href = "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target = "_blank" > boolean< / a > < / code >
< / div >
< div class = "io-description" >
2021-05-11 13:34:23 +02:00
< p > true - If the copy operation is successful.< / p >
2021-05-10 20:56:20 +02:00
< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / section > < h3 > src/app/_helpers/export-csv.ts< / h3 >
< section >
< h3 > < / h3 > < table class = "table table-sm table-bordered" >
< tbody >
< tr >
< td class = "col-md-4" >
< a name = "exportCsv" > < / a >
< span class = "name" >
< b >
exportCsv
< / b >
< a href = "#exportCsv" > < span class = "icon ion-ios-link" > < / span > < / a >
< / span >
< / td >
< / tr >
< tr >
< td class = "col-md-4" >
< code > exportCsv(arrayData, filename, delimiter)< / code >
< / td >
< / tr >
< tr >
< td class = "col-md-4" >
2021-05-11 13:34:23 +02:00
< div class = "io-description" > < p > Exports data to a CSV format and provides a download file.< / p >
< / div >
2021-05-10 20:56:20 +02:00
< div class = "io-description" >
< b > Parameters :< / b >
< table class = "params" >
< thead >
< tr >
< td > Name< / td >
< td > Optional< / td >
2021-05-11 13:34:23 +02:00
< td > Description< / td >
2021-05-10 20:56:20 +02:00
< / tr >
< / thead >
< tbody >
< tr >
< td > arrayData< / td >
< td >
No
< / td >
2021-05-11 13:34:23 +02:00
< td >
< ul >
< li > An array of data to be converted to CSV format.< / li >
< / ul >
< / td >
2021-05-10 20:56:20 +02:00
< / tr >
< tr >
< td > filename< / td >
< td >
No
< / td >
2021-05-11 13:34:23 +02:00
< td >
< ul >
< li > The name of the file to be downloaded.< / li >
< / ul >
< / td >
2021-05-10 20:56:20 +02:00
< / tr >
< tr >
< td > delimiter< / td >
< td >
No
< / td >
< td >
2021-05-11 13:34:23 +02:00
< ul >
< li > The delimiter to be used when converting to CSV format.
Defaults to commas.< / li >
< / ul >
2021-05-10 20:56:20 +02:00
2021-05-11 13:34:23 +02:00
< / td >
2021-05-10 20:56:20 +02:00
< / tr >
< / tbody >
< / table >
< / div >
< div >
< / div >
< div class = "io-description" >
2021-05-11 13:34:23 +02:00
< b > Returns : < / b > < code > < a href = "https://www.typescriptlang.org/docs/handbook/basic-types.html" target = "_blank" > void< / a > < / code >
2021-05-10 20:56:20 +02:00
< / div >
< div class = "io-description" >
< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / section > < h3 > src/app/_helpers/http-getter.ts< / h3 >
< section >
< h3 > < / h3 > < table class = "table table-sm table-bordered" >
< tbody >
< tr >
< td class = "col-md-4" >
< a name = "HttpGetter" > < / a >
< span class = "name" >
< b >
HttpGetter
< / b >
< a href = "#HttpGetter" > < span class = "icon ion-ios-link" > < / span > < / a >
< / span >
< / td >
< / tr >
< tr >
< td class = "col-md-4" >
< code > HttpGetter()< / code >
< / td >
< / tr >
< tr >
< td class = "col-md-4" >
2021-05-11 13:34:23 +02:00
< div class = "io-description" > < p > Provides an avenue of fetching resources via HTTP calls. < / p >
< / div >
2021-05-10 20:56:20 +02:00
< div class = "io-description" >
< b > Returns : < / b > < code > < a href = "https://www.typescriptlang.org/docs/handbook/basic-types.html" target = "_blank" > void< / a > < / code >
< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / section > < h3 > src/app/_helpers/read-csv.ts< / h3 >
< section >
< h3 > < / h3 > < table class = "table table-sm table-bordered" >
< tbody >
< tr >
< td class = "col-md-4" >
< a name = "parseData" > < / a >
< span class = "name" >
< b >
parseData
< / b >
< a href = "#parseData" > < span class = "icon ion-ios-link" > < / span > < / a >
< / span >
< / td >
< / tr >
< tr >
< td class = "col-md-4" >
< code > parseData(data: < a href = "https://www.typescriptlang.org/docs/handbook/basic-types.html" target = "_blank" > any< / a > )< / code >
< / td >
< / tr >
< tr >
< td class = "col-md-4" >
2021-05-11 13:34:23 +02:00
< div class = "io-description" > < p > Parses data to CSV format.< / p >
< / div >
2021-05-10 20:56:20 +02:00
< div class = "io-description" >
< b > Parameters :< / b >
< table class = "params" >
< thead >
< tr >
< td > Name< / td >
< td > Type< / td >
< td > Optional< / td >
2021-05-11 13:34:23 +02:00
< td > Description< / td >
2021-05-10 20:56:20 +02:00
< / tr >
< / thead >
< tbody >
< tr >
< td > data< / td >
< td >
< code > < a href = "https://www.typescriptlang.org/docs/handbook/basic-types.html" target = "_blank" > any< / a > < / code >
< / td >
< td >
No
< / td >
2021-05-11 13:34:23 +02:00
< td >
< ul >
< li > The data to be parsed.< / li >
< / ul >
< / td >
2021-05-10 20:56:20 +02:00
< / tr >
< / tbody >
< / table >
< / div >
< div >
< / div >
< div class = "io-description" >
< b > Returns : < / b > < code > Array< any> < / code >
< / div >
< div class = "io-description" >
2021-05-11 13:34:23 +02:00
< p > An array of the parsed data.< / p >
2021-05-10 20:56:20 +02:00
< / div >
< / td >
< / tr >
< / tbody >
< / table >
< table class = "table table-sm table-bordered" >
< tbody >
< tr >
< td class = "col-md-4" >
< a name = "readCsv" > < / a >
< span class = "name" >
< b >
readCsv
< / b >
< a href = "#readCsv" > < span class = "icon ion-ios-link" > < / span > < / a >
< / span >
< / td >
< / tr >
< tr >
< td class = "col-md-4" >
< code > readCsv(input: < a href = "https://www.typescriptlang.org/docs/handbook/basic-types.html" target = "_blank" > any< / a > )< / code >
< / td >
< / tr >
< tr >
< td class = "col-md-4" >
2021-05-11 13:34:23 +02:00
< div class = "io-description" > < p > Reads a csv file and converts it to an array.< / p >
< / div >
2021-05-10 20:56:20 +02:00
< div class = "io-description" >
< b > Parameters :< / b >
< table class = "params" >
< thead >
< tr >
< td > Name< / td >
< td > Type< / td >
< td > Optional< / td >
2021-05-11 13:34:23 +02:00
< td > Description< / td >
2021-05-10 20:56:20 +02:00
< / tr >
< / thead >
< tbody >
< tr >
< td > input< / td >
< td >
< code > < a href = "https://www.typescriptlang.org/docs/handbook/basic-types.html" target = "_blank" > any< / a > < / code >
< / td >
< td >
No
< / td >
2021-05-11 13:34:23 +02:00
< td >
< ul >
< li > The file to be read.< / li >
< / ul >
< / td >
2021-05-10 20:56:20 +02:00
< / tr >
< / tbody >
< / table >
< / div >
< div >
< / div >
< div class = "io-description" >
< b > Returns : < / b > < code > Array | void< / code >
< / div >
< div class = "io-description" >
2021-05-11 13:34:23 +02:00
< p > An array of the read data.< / p >
2021-05-10 20:56:20 +02:00
< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / section > < h3 > src/app/_helpers/schema-validation.ts< / h3 >
< section >
< h3 > < / h3 > < table class = "table table-sm table-bordered" >
< tbody >
< tr >
< td class = "col-md-4" >
< a name = "personValidation" > < / a >
< span class = "name" >
< b >
personValidation
< / b >
< a href = "#personValidation" > < span class = "icon ion-ios-link" > < / span > < / a >
< / span >
< / td >
< / tr >
< tr >
< td class = "col-md-4" >
< code > personValidation(person: < a href = "https://www.typescriptlang.org/docs/handbook/basic-types.html" target = "_blank" > any< / a > )< / code >
< / td >
< / tr >
< tr >
< td class = "col-md-4" >
2021-05-11 13:34:23 +02:00
< div class = "io-description" > < p > Validates a person object against the defined Person schema.< / p >
< / div >
2021-05-10 20:56:20 +02:00
< div class = "io-description" >
< b > Parameters :< / b >
< table class = "params" >
< thead >
< tr >
< td > Name< / td >
< td > Type< / td >
< td > Optional< / td >
2021-05-11 13:34:23 +02:00
< td > Description< / td >
2021-05-10 20:56:20 +02:00
< / tr >
< / thead >
< tbody >
< tr >
< td > person< / td >
< td >
< code > < a href = "https://www.typescriptlang.org/docs/handbook/basic-types.html" target = "_blank" > any< / a > < / code >
< / td >
< td >
No
< / td >
2021-05-11 13:34:23 +02:00
< td >
< ul >
< li > A person object to be validated.< / li >
< / ul >
< / td >
2021-05-10 20:56:20 +02:00
< / tr >
< / tbody >
< / table >
< / div >
< div >
< / div >
< div class = "io-description" >
< b > Returns : < / b > < code > Promise< void> < / code >
< / div >
< div class = "io-description" >
< / div >
< / td >
< / tr >
< / tbody >
< / table >
< table class = "table table-sm table-bordered" >
< tbody >
< tr >
< td class = "col-md-4" >
< a name = "vcardValidation" > < / a >
< span class = "name" >
< b >
vcardValidation
< / b >
< a href = "#vcardValidation" > < span class = "icon ion-ios-link" > < / span > < / a >
< / span >
< / td >
< / tr >
< tr >
< td class = "col-md-4" >
< code > vcardValidation(vcard: < a href = "https://www.typescriptlang.org/docs/handbook/basic-types.html" target = "_blank" > any< / a > )< / code >
< / td >
< / tr >
< tr >
< td class = "col-md-4" >
2021-05-11 13:34:23 +02:00
< div class = "io-description" > < p > Validates a vcard object against the defined Vcard schema.< / p >
< / div >
2021-05-10 20:56:20 +02:00
< div class = "io-description" >
< b > Parameters :< / b >
< table class = "params" >
< thead >
< tr >
< td > Name< / td >
< td > Type< / td >
< td > Optional< / td >
2021-05-11 13:34:23 +02:00
< td > Description< / td >
2021-05-10 20:56:20 +02:00
< / tr >
< / thead >
< tbody >
< tr >
< td > vcard< / td >
< td >
< code > < a href = "https://www.typescriptlang.org/docs/handbook/basic-types.html" target = "_blank" > any< / a > < / code >
< / td >
< td >
No
< / td >
2021-05-11 13:34:23 +02:00
< td >
< ul >
< li > A vcard object to be validated.< / li >
< / ul >
< / td >
2021-05-10 20:56:20 +02:00
< / tr >
< / tbody >
< / table >
< / div >
< div >
< / div >
< div class = "io-description" >
< b > Returns : < / b > < code > Promise< void> < / code >
< / div >
< div class = "io-description" >
< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / section >
< / div > < div class = "search-results" >
< div class = "has-results" >
< h1 class = "search-results-title" > < span class = 'search-results-count' > < / span > result-matching "< span class = 'search-query' > < / span > "< / h1 >
< ul class = "search-results-list" > < / ul >
< / div >
< div class = "no-results" >
< h1 class = "search-results-title" > No results matching "< span class = 'search-query' > < / span > "< / h1 >
< / div >
< / div >
< / div >
<!-- END CONTENT -->
< / div >
< / div >
< script >
var COMPODOC_CURRENT_PAGE_DEPTH = 1;
var COMPODOC_CURRENT_PAGE_CONTEXT = 'miscellaneous-functions';
var COMPODOC_CURRENT_PAGE_URL = 'functions.html';
var MAX_SEARCH_RESULTS = 15;
< / script >
< script src = "../js/libs/custom-elements.min.js" > < / script >
< script src = "../js/libs/lit-html.js" > < / script >
<!-- Required to polyfill modern browsers as code is ES5 for IE... -->
< script src = "../js/libs/custom-elements-es5-adapter.js" charset = "utf-8" defer > < / script >
< script src = "../js/menu-wc.js" defer > < / script >
< script src = "../js/libs/bootstrap-native.js" > < / script >
< script src = "../js/libs/es6-shim.min.js" > < / script >
< script src = "../js/libs/EventDispatcher.js" > < / script >
< script src = "../js/libs/promise.min.js" > < / script >
< script src = "../js/libs/zepto.min.js" > < / script >
< script src = "../js/compodoc.js" > < / script >
< script src = "../js/tabs.js" > < / script >
< script src = "../js/menu.js" > < / script >
< script src = "../js/libs/clipboard.min.js" > < / script >
< script src = "../js/libs/prism.js" > < / script >
< script src = "../js/sourceCode.js" > < / script >
< script src = "../js/search/search.js" > < / script >
< script src = "../js/search/lunr.min.js" > < / script >
< script src = "../js/search/search-lunr.js" > < / script >
< script src = "../js/search/search_index.js" > < / script >
< script src = "../js/lazy-load-graphs.js" > < / script >
< / body >
< / html >