spotify-ts-wrapper
Version:
Spotify TypeScript wrapper.
15 lines (14 loc) • 480 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractSpotifyID = extractSpotifyID;
function extractSpotifyID(uri) {
if (!(uri === null || uri === void 0 ? void 0 : uri.startsWith("spotify:")))
return "Either the value is undefined or not a valid Spotify id.";
const parts = uri.split(":");
if (parts.length === 3) {
return parts[2];
}
else {
throw new Error("Invalid Spotify URI format");
}
}