src/responder.js
function extractPermlinkFromLink(steemitLink) {
  if (isValidSteemitLink(steemitLink)) {
    const usernamePos = steemitLink.search(/\/@.+\//);
    if (usernamePos === -1) return;

    const firstPart = steemitLink.slice(usernamePos + 1); // adding 1 to remove the first "/"
    return firstPart.slice(firstPart.search('/') + 1).replace('/', '').replace('#', '');
  }
}
function extractPermlinkFromLink(steemitLink) {
  if (isValidSteemitLink(steemitLink)) {
    const usernamePos = steemitLink.search(/\/@.+\//);
    if (usernamePos === -1) return;

    const firstPart = steemitLink.slice(usernamePos + 1); // adding 1 to remove the first "/"
    return firstPart.slice(firstPart.search('/') + 1).replace('/', '').replace('#', '');
  }
}
function extractPermlinkFromLink ( steemitLink ) { if ( isValidSteemitLink ( steemitLink ) ) { const usernamePos = steemitLink . search ( / \/@.+\/ / ) ; if ( usernamePos === - 1 ) return ; const firstPart = steemitLink . slice ( usernamePos + 1 ) ; // adding 1 to remove the first "/" return firstPart . slice ( firstPart . search ( '/' ) + 1 ) . replace ( '/' , '' ) . replace ( '#' , '' ) ; } }
Should input a full steemit article link and return the permlink of the article
@param {string} steemitLink
Should input a full steemit article link and return the permlink of the article