Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jstrip

Package Overview
Dependencies
Maintainers
1
Versions
231
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jstrip

webpage crawler manipulation

  • 0.0.20
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

jStrip

Pass a webpage uri with pure jQuery to jStrip and retrieve the results. The results are returned via a Promise or Async/Await, examples below.

Installing

Start with installing jStrip. Install with npm.

npm i -S jStrip

Include jStrip into your code.

const jStrip = require('jStrip');

jStrip takes 2 String Parameters, comma delimited: [webpage] and [jQuery]. For example:

jStrip("http://www.google.com","$('title').html()");

jStrip returns an object, with four properties:

  • data: the results from your jquery selector.
  • timed: milliseconds taken for uri retrieval.
  • uri: the uri of the page.
  • jquery: the jquery executed on the uri.

for example:

{
  data:  "Sunny with light winds.",
  timed: 1238,
  uri: "http://www.my-weather.co.nz",
  jquery: "$('div#weatherDesc').html()"
}

jStrip can be written as a Promise or as Async/Await.

Using Promises

// Using Promise
jStrip('https://www.bing.com', "$('title').html()")
  .then((result) => {
    console.log(`promise result: ${result.data}
      time taken: ${result.timed}
      uri: ${result.uri}
      jquery: ${result.jquery}`);
  })
  .catch((e) => {
    console.log(`Error: ${e}`);
  });

Using Async/Await

// Using Async/Await
const fn = (async () => {
  try {
    const result = await jStrip('https://www.youtube.com', "$('title').html()");
    await console.log(`async/await result: ${result.data}
      time taken: ${result.timed}
      uri: ${result.uri}
      jquery: ${result.jquery}`);
  } catch (err) {
    console.log(`error ${err}`);
  }
})();

Versioning

We use SemVer for versioning.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Keywords

FAQs

Package last updated on 27 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc