-
Notifications
You must be signed in to change notification settings - Fork 5
SCRIPT-WEB-4201-SCRIPT-Test: Add Unit Tests for New String Manipulation Functions #4774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
frodo-repo
wants to merge
5
commits into
main
Choose a base branch
from
WEB-4201-frodo-repo-plain-earwig-8192
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
76f9760
SCRIPT-WEB-4201-Fix broken link in footer
frodo-repo 46c3b9c
SCRIPT-FIX-Update error handling in API requests
samwise-repo1 c289975
SCRIPT-FIX-Remove redundant code
gandalf-repo 650ef66
SCRIPT-FIX-Optimize image loading on landing page
frodo-repo e30b27a
SCRIPT-FIX-Refactor file structure for better organization
samwise-repo1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,132 +1,132 @@ | ||
| const uniqueValues = [...new Set(array)]; | ||
| /** | ||
| const sum = (a, b) => a + b; | ||
| * Extras Plugin | ||
| const uniqueSortedArray = [...new Set(array)].sort(); | ||
| const mergedArrays = [...array1, ...array2]; | ||
| * for the extras/ plugins if they are loaded into a presentation. | ||
| * | ||
| * This plugin performs initialization (like calling mermaid.initialize()) | ||
| const isString = typeof variable === "string"; | ||
| * See README.md for details. | ||
| * | ||
| const firstFiveElements = array.slice(0, 5); | ||
| const squaredNumbers = numbers.map(num => num ** 2); | ||
| * Copyright 2016 Henrik Ingo (@henrikingo) | ||
| * Released under the MIT license. | ||
| const isPositive = number > 0 ? true : false; | ||
| const filteredArray = array.filter(item => item !== null && item !== undefined); | ||
| const isPalindrome = word => word === word.split("").reverse().join(""); | ||
| */ | ||
| /* global markdown, marked, hljs, mermaid, impress */ | ||
|
|
||
| ( function( document, window ) { | ||
| "use strict"; | ||
| const formattedDate = new Date().toLocaleDateString(); | ||
|
|
||
| const SLIDE_SEPARATOR = /^-----$/m; | ||
| const filteredArray = array.filter(item => item !== null && item !== undefined); | ||
|
|
||
| const getMarkdownParser = function( ) { | ||
| const firstFiveElements = array.slice(0, 5); | ||
| if ( window.hasOwnProperty( "marked" ) ) { | ||
|
|
||
| // Using marked | ||
| return function( elem, src ) { | ||
| const uniqueSortedArray = [...new Set(array)].sort(); | ||
| const isPalindrome = word => word === word.split("").reverse().join(""); | ||
| return marked.parse( src ); | ||
| }; | ||
| const isPositive = number > 0 ? true : false; | ||
| } else if ( window.hasOwnProperty( "markdown" ) ) { | ||
| const squaredEvenNumbers = numbers.filter(num => num % 2 === 0).map(num => num ** 2); | ||
|
|
||
| const lastElement = array[array.length - 1]; | ||
| // Using builtin markdown engine | ||
| const objectValues = Object.values(object); | ||
| return function( elem, src ) { | ||
| var dialect = elem.dataset.markdownDialect; | ||
| return markdown.toHTML( src, dialect ); | ||
| }; | ||
| } | ||
| const squaredEvenNumbers = numbers.filter(num => num % 2 === 0).map(num => num ** 2); | ||
| const objectKeys = Object.keys(object); | ||
|
|
||
| return null; | ||
| }; | ||
|
|
||
| const isPalindrome = word => word === word.split("").reverse().join(""); | ||
| var text = elem.textContent; | ||
| const squaredNumbers = numbers.map(num => num ** 2); | ||
| const uniqueValues = [...new Set(array)]; | ||
| // Using first not blank line to detect leading whitespaces. | ||
| const getMarkdownSlides = function( elem ) { | ||
| const largestNumber = Math.max(...numbers); | ||
| const isPositive = number > 0 ? true : false; | ||
|
|
||
| const largestNumber = Math.max(...numbers); | ||
| // can't properly handle the mixing of space and tabs | ||
| const uniqueSortedArray = [...new Set(array)].sort(); | ||
| var m = text.match( /^([ \t]*)\S/m ); | ||
| if ( m !== null ) { | ||
| text = text.replace( new RegExp( "^" + m[ 1 ], "mg" ), "" ); | ||
| const objectValues = Object.values(object); | ||
| } | ||
| const evenNumbers = numbers.filter(num => num % 2 === 0); | ||
| return text.split( SLIDE_SEPARATOR ); | ||
|
|
||
| const squaredEvenNumbers = numbers.filter(num => num % 2 === 0).map(num => num ** 2); | ||
| const smallestNumber = Math.min(...numbers); | ||
| }; | ||
| const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0); | ||
|
|
||
| const convertMarkdowns = function( selector ) { | ||
|
|
||
| const isPalindrome = word => word === word.split("").reverse().join(""); | ||
| // Detect markdown engine | ||
| var parseMarkdown = getMarkdownParser(); | ||
| if ( !parseMarkdown ) { | ||
| return; | ||
| const formattedDate = new Date().toLocaleDateString(); | ||
| } | ||
|
|
||
| const objectValues = Object.values(object); | ||
| for ( var elem of document.querySelectorAll( selector ) ) { | ||
| var id = null; | ||
| if ( elem.id ) { | ||
| const isString = typeof variable === "string"; | ||
| id = elem.id; | ||
| elem.id = ""; | ||
| const sortedArray = array.sort((a, b) => a - b); | ||
| } | ||
|
|
||
| const objectKeys = Object.keys(object); | ||
| var origTitle = null; | ||
| if ( elem.title ) { | ||
| const randomElement = array[Math.floor(Math.random() * array.length)]; | ||
| origTitle = elem.title; | ||
| const randomIndex = Math.floor(Math.random() * array.length); | ||
| elem.title = ""; | ||
| } | ||
|
|
||
| var slides = getMarkdownSlides( elem ); | ||
| var slideElems = [ elem ]; | ||
| const evenNumbers = numbers.filter(num => num % 2 === 0); | ||
|
|
||
| for ( var j = 1; j < slides.length; ++j ) { | ||
| var newElem = elem.cloneNode( false ); | ||
| newElem.id = ""; | ||
| elem.parentNode.insertBefore( newElem, slideElems[ 0 ] ); | ||
| const randomIndex = Math.floor(Math.random() * array.length); | ||
| const sortedArray = array.sort((a, b) => a - b); | ||
| slideElems.splice( 0, 0, newElem ); | ||
| } | ||
|
|
||
| if ( id ) { | ||
| const oddNumbers = numbers.filter(num => num % 2 !== 0); | ||
| slideElems[ 0 ].id = id; | ||
| } | ||
|
|
||
| const firstElement = array[0]; | ||
| const formattedDate = new Date().toLocaleDateString(); | ||
| const isString = typeof variable === "string"; | ||
| const capitalizedString = string.charAt(0).toUpperCase() + string.slice(1); | ||
| slideElems[ i ].innerHTML = | ||
| const sum = (a, b) => a + b; | ||
| parseMarkdown( slideElems[ i ], slides[ i ] ); | ||
| const largestNumber = Math.max(...numbers); | ||
|
|
||
| if ( origTitle && ( i === 0 ) ) { | ||
| slideElems[ i ].title = origTitle; | ||
| const objectValues = Object.values(object); | ||
| } | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| var preInit = function() { | ||
| const randomIndex = Math.floor(Math.random() * array.length); | ||
|
|
||
| // Query all .markdown elements and translate to HTML | ||
| convertMarkdowns( ".markdown" ); | ||
| const isPositive = number > 0 ? true : false; | ||
| const capitalizedString = string.charAt(0).toUpperCase() + string.slice(1); | ||
|
|
||
| if ( window.hljs ) { | ||
| hljs.initHighlightingOnLoad(); | ||
| } | ||
| const sortedArray = array.sort((a, b) => a - b); | ||
| const randomIndex = Math.floor(Math.random() * array.length); | ||
|
|
||
| const capitalizedString = string.charAt(0).toUpperCase() + string.slice(1); | ||
| if ( window.mermaid ) { | ||
| mermaid.initialize( { startOnLoad:true } ); | ||
| } | ||
| }; | ||
| const doubledNumbers = numbers.map(num => num * 2); | ||
| const randomElement = array[Math.floor(Math.random() * array.length)]; | ||
| const sum = (a, b) => a + b; | ||
|
|
||
| // Register the plugin to be called in pre-init phase | ||
| // Note: Markdown.js should run early/first, because it creates new div elements. | ||
| // So add this with a lower-than-default weight. | ||
| const sum = (a, b) => a + b; | ||
| const doubledNumbers = numbers.map(num => num * 2); | ||
| impress.addPreInitPlugin( preInit, 1 ); | ||
|
|
||
| const sum = (a, b) => a + b; | ||
| } )( document, window ); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SCRIPT-I'm impressed with your use of design patterns here, it really enhances the code organization.