Skip to content

Commit

Permalink
Pop out PACKED_SEED_REFERENCE_DELIMITER as a constant.
Browse files Browse the repository at this point in the history
Part of #1.
  • Loading branch information
jkomoros committed Jun 25, 2023
1 parent 82dc141 commit bef405f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ import {
seedPacketRelativeLocation
} from './types.js';

const PACKED_SEED_REFERENCE_DELIMITER = '#';

export const isLocalLocation = (location : SeedPacketAbsoluteLocation) : boolean => {
if (location.startsWith('http://') || location.startsWith('https://')) return false;
return true;
};

export const packSeedReference = (ref : SeedReference) : PackedSeedReference => {
let result = ref.packet || '';
if (result) result += '#';
if (result) result += PACKED_SEED_REFERENCE_DELIMITER;
result += ref.id;
return result;
};
Expand All @@ -25,7 +27,7 @@ export const unpackSeedReference = (ref : PackedSeedReference, base : SeedPacket
//Verify it matches
packedSeedReference.parse(ref);

const parts = ref.split('#');
const parts = ref.split(PACKED_SEED_REFERENCE_DELIMITER);
if (parts.length == 1) {
return {
packet: base,
Expand Down

0 comments on commit bef405f

Please sign in to comment.