-
Notifications
You must be signed in to change notification settings - Fork 572
Issues and v2 work updates #189
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
karnthis
wants to merge
15
commits into
pieroxy:master
Choose a base branch
from
karnthis:master
base: master
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 4 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ce476fe
Merge pull request #1 from pieroxy/master
karnthis a1e8dd0
Chore: address invalid Base64 returns (/pieroxy/lz-string/issues/184)
karnthis aec06d2
Chore: address invalid Base64 encoding (/pieroxy/lz-string/issues/110)
karnthis 32e6ed1
Chore: implements Base64URL suggestion (/pieroxy/lz-string/pull/127)
karnthis b8f6898
removing browser-specific elements from utils
karnthis c0eeb08
tests pt.1 - splitting into reusable library
karnthis e6c2537
tests pt.2 - breaking out test sets to allow for variations
karnthis 4b030c6
tests pt.3 - started creating more specific tests. all tests now pass
karnthis 42d7a24
tests pt.4 - safer test running
karnthis 6e33f3a
Merge branch master 'pieroxy/master' into resync
karnthis bde410d
refactored updates
karnthis 89a6f53
formatting
karnthis 286ff3b
pr suggestion: reorganize new functions
karnthis 9d2a326
pr suggestion: refactor function names
karnthis 229d9fa
pr suggestion: refactor test logic
karnthis 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { _compress } from "../_compress"; | ||
import { _decompress } from "../_decompress"; | ||
import { getBaseValue } from "../getBaseValue"; | ||
|
||
const keyStrBase64URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; | ||
|
||
export function compressToBase64URL(input: string): string { | ||
if (!input) { | ||
return ""; | ||
} | ||
return _compress(input, 6, (a) => keyStrBase64URL.charAt(a)); | ||
} | ||
|
||
export function decompressFromBase64URL(input: string): string { | ||
if (!input) { | ||
return ""; | ||
} | ||
const res = _decompress(input.length, 32, (index) => getBaseValue(keyStrBase64URL, input.charAt(index))); | ||
return res || ""; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { _compress } from "../_compress"; | ||
import keyStrBase64 from "./keyStrBase64"; | ||
import { _decompress } from "../_decompress"; | ||
import { getBaseValue } from "../getBaseValue"; | ||
|
||
export function compressToBetterBase64(input: string): string { | ||
if (!input) { | ||
return ""; | ||
} | ||
const res = _compress(input, 6, (a) => keyStrBase64.charAt(a)); | ||
|
||
// To produce valid Base64 | ||
switch (res.length % 3) { | ||
case 0: | ||
return res; | ||
case 1: | ||
return res + "=="; | ||
case 2: | ||
return res + "="; | ||
default: // When could this happen ? | ||
console.warn("Something in compressToBetterBase64() is very very wrong."); | ||
return ""; | ||
} | ||
|
||
} | ||
|
||
export function decompressFromBetterBase64(input: string): string { | ||
if (!input) { | ||
return ""; | ||
} | ||
const res = _decompress(input.length, 32, (index) => getBaseValue(keyStrBase64, input.charAt(index))); | ||
return res || ""; | ||
} |
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
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
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,2 +1,4 @@ | ||
export { compressToBase64 } from "./compressToBase64"; | ||
export { decompressFromBase64 } from "./decompressFromBase64"; | ||
export { compressToBetterBase64, decompressFromBetterBase64 } from "./betterBase64"; | ||
export { compressToBase64URL, decompressFromBase64URL } from "./base64URL"; |
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
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
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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
type VERSIONS = "v2.0.0" | ||
|
||
export function deprecated( | ||
thing: string, | ||
version: VERSIONS, | ||
opts?: { aggressive?: boolean; replacement?: string } | ||
): void { | ||
let notice = `LZString | ${thing} is deprecated as of: ${version}` | ||
if (opts?.replacement) { | ||
notice += ` - Please use ${opts.replacement} instead` | ||
} | ||
console.error(notice) | ||
if (window && opts?.aggressive) alert(notice) | ||
} |
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
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.
Uh oh!
There was an error while loading. Please reload this page.