forked from b00tc4mp/isdi-parttime-202406
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add completed prototypes b00tc4mp#185
- Loading branch information
carlos
committed
Sep 2, 2024
1 parent
9eca66b
commit 646ff49
Showing
11 changed files
with
167 additions
and
120 deletions.
There are no files selected for viewing
This file contains 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,9 +1,9 @@ | ||
function ChainCharacter(value) { | ||
function ChainCharacters(value) { | ||
let _length = 0; | ||
while(value[_length]) _length++; | ||
|
||
this.length = _length; | ||
this.value = value; | ||
} | ||
|
||
module.exports = ChainCharacter; | ||
module.exports = ChainCharacters; |
This file contains 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
This file contains 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,3 +1,10 @@ | ||
require("./at.test.js"); | ||
require("./charAt.test.js"); | ||
require("./concat.test.js"); | ||
require("./concat.test.js"); | ||
|
||
|
||
require("./split.test.js"); | ||
|
||
require("./toLowerCase.test.js"); | ||
require("./toUpperCase.test.js"); | ||
require("./trim.test.js"); |
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
const ChainCharacters = require("./"); | ||
|
||
function compare(array1, array2) { | ||
let result = true; | ||
let i = 0; | ||
if (array1.length !== array2.length) return false; | ||
while (i < array1.length) { | ||
if (array1[i].value !== array2[i]) { | ||
result = false; | ||
} | ||
i++; | ||
} | ||
return result; | ||
} | ||
|
||
|
||
//const str = 'Esta es una oración que tiene que estar split.'; | ||
const pattern = ""; | ||
const pattern2 = " "; | ||
const pattern3 = "q"; | ||
const pattern4 = "e"; | ||
|
||
//const result1 = split(str, pattern); | ||
//const result2 = split(str, pattern2); | ||
//const result3 = split(str, pattern3); | ||
//const result4 = split(str, pattern4); | ||
|
||
|
||
const result1 = new ChainCharacters('Esta es una oración que tiene que estar split.').split(pattern); | ||
console.assert(compare(result1, 'Esta es una oración que tiene que estar split.'.split(pattern)),{ | ||
result: result1, | ||
message: "Test 1 No pasado ", | ||
}); | ||
|
||
/* | ||
console.assert(compare(result2, str.split(pattern2)),{ | ||
result: result2, | ||
message: "Test 2 No pasado ", | ||
}); | ||
console.assert(compare(result3, str.split(pattern3)),{ | ||
result: result3, | ||
message: "Test 3 No pasado ", | ||
}); | ||
console.assert(compare(result4, str.split(pattern4)),{ | ||
result: result4, | ||
message: "Test 3 No pasado ", | ||
}); | ||
*/ |
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
const ChainCharacters = require("./"); | ||
|
||
const oldString = "THIS IS A STRING WITH UPPERCASE"; | ||
const oldString2 = "This Is a Test"; | ||
|
||
|
||
const result1 = new ChainCharacters(oldString).toLowerCase(); | ||
console.assert(result1.value === oldString.toLowerCase(),{ | ||
result: result1, | ||
message: "Test 1 No pasado ", | ||
}); | ||
|
||
const result2 = new ChainCharacters(oldString2).toLowerCase(); | ||
console.assert(result2.value === oldString2.toLowerCase(), { | ||
result: result2, | ||
message: "Test 2 No pasado ", | ||
}); | ||
|
||
|
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
const ChainCharacters = require("./"); | ||
|
||
const oldString = "this is a lower case string"; | ||
const oldString2 = "This Is a Test"; | ||
|
||
|
||
const result1 = new ChainCharacters(oldString).toUpperCase(); | ||
console.assert(result1.value === oldString.toUpperCase(),{ | ||
result: result1, | ||
message: "Test 1 No pasado ", | ||
}); | ||
|
||
const result2 = new ChainCharacters(oldString2).toUpperCase(); | ||
console.assert(result2.value === oldString2.toUpperCase(), { | ||
result: result2, | ||
message: "Test 2 No pasado ", | ||
}); | ||
|
||
|
||
|
This file contains 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.