laurengarcia / url-metadata

NPM module: Request a url and scrape the metadata from its HTML using Node.js or the browser.
https://www.npmjs.com/package/url-metadata
MIT License
166 stars 44 forks source link

Issue #75 Add missing parseResponseObject property #78

Closed ajmas closed 8 months ago

ajmas commented 8 months ago

Check one:

Steps to reproduce (if bug):

  1. Specify parseResponseObject in the options of the url-metadata function call
  2. Reported as unknown property

Feature request:

Please attach screenshots if helpful

BTW skipped Husky initiated tests due to problem reported in issue #77

laurengarcia commented 8 months ago

Thanks for sending this. Since this module is meant to run both in Node.js & the browser, i resolved it this way so it would work for both environments:

declare namespace urlMetadata {
  interface Options {
    ...
    parseResponseObject?: Response | import('node-fetch').Response;
  }
  type Result = Record<string, string | boolean | undefined | any>;
}

See: https://github.com/laurengarcia/url-metadata/blob/master/index.d.ts

Fix is in the latest version 3.5.3 https://www.npmjs.com/package/url-metadata

Let me know if you have further issues. Thanks.