Skip to content

Commit

Permalink
Merge pull request #5 from ardentkilnfire/feat/w2ascii-function
Browse files Browse the repository at this point in the history
Implement `w2ascii` function
  • Loading branch information
henilmalaviya authored Aug 19, 2024
2 parents 8c4af53 + 88f64ac commit 1d31d37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { not } from './not';
export { w2ascii } from './w2ascii';
8 changes: 7 additions & 1 deletion src/w2ascii.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
// Waiting for henil0604 to implement this 😃!
export function w2ascii(str: string): number {
let sum = 0;
for (let i = 0; i < str.length && str[i] !== ' '; i++) {
sum += str.charCodeAt(i);
}
return sum;
}

0 comments on commit 1d31d37

Please sign in to comment.