npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vajehyab

v1.0.3

Published

VajehYab API client written in JS

Downloads

12

Readme

VajehYab

VajehYab API client written in JS

Install

npm install vajehyab --save

Usage
You can get VajehYab API token from Developer Page (API Documentation)

const VajehYab = require('vajehyab');
const vajehyabToken = process.env.vajehyabToken; // VajehYab API Token
const client = new VajehYab(vajehyabToken, {ip, product, prettyprint, debug});
  • params
    • token: VajehYab API token
    • ip: The User IP. Default is , (Optional)
    • product: The product name. Default is , (Optional)
    • prettyprint: The response pretty printed. Default is true, (Optional)
    • debug: The debug mode. Default is false, (Optional)

Example

const VajehYab = require('vajehyab');
const vajehyabToken = process.env.vajehyabToken; // VajehYab API Token
const client = new VajehYab(vajehyabToken, {ip:'222.2.65.3', product: 'Test', prettyprint: true, debug: false});

All method using async/await in Node >= 8

Search

This method is used to search for a term or phrase. The meaning of the word is limited and insert "..." at the end.

(async () => {
    try {
        const search = await client.search(q, {type, start, rows, filter});
        console.log(search);
    } catch (e) {
        console.log(e);
    }
})();
  • params
    • q: The search word
    • type: The search type, You can set exact,ava,like,text. Default is exact, (Optional)
    • start: The start row. Default is 0, (Optional)
    • rows: The response rows. Default is 10, (Optional)
    • filter: The Database names with priority. Default is dehkhoda, moein, amid, motaradef, farhangestan, sareh, ganjvajeh, wiki, slang, quran, name, thesis, isfahani, bakhtiari, tehrani, dezfuli, gonabadi, mazani, en2fa, ar2fa, fa2en, fa2ar, (Optional)

Example

(async () => {
    try {
        const search = await client.search('رایانه');
        console.log(search);
    } catch (e) {
        console.log(e);
    }
})();
const search = await client.search('رایانه', {type: 'like', start: 0, rows: 10, filter: 'dehkhoda,moein,amid'});
console.log(search);

Word Detail:

This method is used to get the full meaning of a word. It is possible with HTML tags.

const word = await client.word(title, db, num);
  • params
    • title: The word from search method response
    • db: The Database name from search method response
    • num: The num parameter from search method response

Example

const word = await client.word('ایران', 'dehkhoda', 1);
console.log(word);

Suggest Word:

The proposed list is used for autocomplete.

const suggest = await client.suggest(q);
  • params
    • q: The search word

Example

const suggest = await client.suggest('ایران');
console.log(suggest);

Express Example

const VajehYab = require('vajehyab');
const vajehyabToken = process.env.vajehyabToken; // VajehYab API Token
const client = new VajehYab(vajehyabToken, {ip:'222.2.65.3', product: 'Test', prettyprint: true, debug: false});
const express = require('express');
const app = express();

app.get('/', (req, res) => {
    (async () => {
        try {
            const search = await client.search('رایانه');
            res.send(search);
        } catch (e) {
            res.send(e);
        }
    })();
}).listen(3000);