Skip to content

Commit

Permalink
v.0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alyxshang committed Sep 27, 2024
1 parent af6d067 commit 5aa39c7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
deno.lock
deno.lock
/docs
4 changes: 2 additions & 2 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ This repository contains the source code for a Deno module to retrieve informati

### APIs

To find out how to use this module and which APIs this module provides you can visit the documentation page [here](https://alyxshang.boo/shangshield.ts).
To find out how to use this module and which APIs this module provides, run the command `deno doc --html mod.ts` from the root of this repository.

### Importing

Any of the functions this module provides can be imported from the following HTTPS URL: `https://raw.githubusercontent.com/alyxshang/shangshield.ts/main/mod.ts`.

### Testing

To run the tests this module provides you can use the `deno test` commmand. This command has to be run from the root of this repository.
To run the tests this module provides, you can use the `deno test` commmand. This command has to be run from the root of this repository.

## CHANGELOG :black_nib:

Expand Down
28 changes: 14 additions & 14 deletions mod_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,85 +29,85 @@ const testResult: SecurityInfo = {
isSecure: true
};

// Testing the \"isDigit\" function. (true case).
// Testing the "isDigit" function. (true case).
Deno.test(
"Testing the \"isDigit\" function. (true case)",
() => assertEquals(shangshield.isDigit("3"),(true))
)

// Testing the \"isDigit\" function. (false case)
// Testing the "isDigit" function. (false case)
Deno.test(
"Testing the \"isDigit\" function. (false case)",
() => assertEquals(shangshield.isDigit("A"),(false))
)

// Testing the \"isLetter\" function. (true case)
// Testing the "isLetter" function. (true case)
Deno.test(
"Testing the \"isLetter\" function. (true case)",
() => assertEquals(shangshield.isLetter("A"),(true))
)

// Testing the \"isLetter\" function. (false case)
// Testing the "isLetter" function. (false case)
Deno.test(
"Testing the \"isLetter\" function. (false case)",
() => assertEquals(shangshield.isLetter("3"),(false))
)

// Testing the \"stringType\" function. (letter)
// Testing the "stringType" function. (letter)
Deno.test(
"Testing the \"stringType\" function. (letter)",
() => assertEquals(shangshield.stringType("A"), "letter")
)

// Testing the \"stringType\" function. (digit)
// Testing the "stringType" function. (digit)
Deno.test(
"Testing the \"stringType\" function. (digit)",
() => assertEquals(shangshield.stringType("3"), "digit")
)

// Testing the \"stringType\" function. (special)
// Testing the "stringType" function. (special)
Deno.test(
"Testing the \"stringType\" function. (special)",
() => assertEquals(shangshield.stringType("@"), "special")
)

// Testing the \"getPositionFromChar\" function.
// Testing the "getPositionFromChar" function.
Deno.test(
"Testing the \"getPositionFromChar\" function.",
() => assertEquals(shangshield.getPositionFromChar("D"), 4)
)

// Testing the \"digitDistance\" function. (normal case)
// Testing the "digitDistance" function. (normal case)
Deno.test(
"Testing the \"digitDistance\" function. (normal case)",
() => assertEquals(shangshield.digitDistance(4, 24), 20)
)

// Testing the \"digitDistance\" function. (special case)
// Testing the "digitDistance" function. (special case)
Deno.test(
"Testing the \"digitDistance\" function. (special case)",
() => assertEquals(shangshield.digitDistance(24, 4), 20)
)

// Testing the \"isSecure\" function. (true case)
// Testing the "isSecure" function. (true case)
Deno.test(
"Testing the \"isSecure\" function. (true case)",
() => assertEquals(shangshield.isSecure(pwd,letterWeight,specialCharWeight,100), true)
)

// Testing the \"isSecure\" function. (false case)
// Testing the "isSecure" function. (false case)
Deno.test(
"Testing the \"isSecure\" function. (false case)",
() => assertEquals(shangshield.isSecure("123456",letterWeight,specialCharWeight,100), false)
)

// Testing the \"securityScore\" function.
// Testing the "securityScore" function.
Deno.test(
"Testing the \"securityScore\" function.",
() => assertEquals(shangshield.securityScore("123456",letterWeight,specialCharWeight), falseScore)
)

// Testing the \"shieldSummary\" function.
// Testing the "shieldSummary" function.
Deno.test(
"Testing the \"shieldSummary\" function.",
() => assertEquals(shangshield.shieldSummary(pwd,letterWeight,specialCharWeight,cutOff), testResult)
Expand Down
6 changes: 3 additions & 3 deletions src/shangshield.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ interface SecurityInfo {
* Subtracts two numbers from each other, regardless of which
* one of the two is larger than the other.
* @param {number} one The first number to conduct a subtraction on.
* @param {number} two The first number to conduct a subtraction on.
* @returns {number} Returns the result of the subtraction's result.
* @param {number} two The second number to conduct a subtraction on.
* @returns {number} Returns the result of the subtraction.
*/
export function digitDistance(
one: number,
Expand Down Expand Up @@ -126,7 +126,7 @@ export function stringType(char: string): string {
* @param {string} char The character to reduce to a number entity.
* @param {number} letterWeight The weight assigned to normal alphabets.
* @param {number} specialCharWeight The weight assigned to special characters.
* @returns {number} The number that the character has been reduced to is returned.
* @returns {number} The number the character has been reduced to is returned.
*/
export function reduceCharactersToNumber(
char: string,
Expand Down

0 comments on commit 5aa39c7

Please sign in to comment.