open-index/open-npm huggingface dataset:
npm package: @pritch9/auth0r
Description: Auth0r is a plug-in play package that will handle user authorizations and requests.
Author: pritch9
Latest version: 0.1.10

# Auth0r
Welcome to Auth0r, the all-in-one user management module.


## Usage
There are a few hooks to allow you to customize the usage of Auth0r in your API.  Please let me know if I should release specific usage guides for different API types (REST, GrahpQL, etc.).

To initialize Auth0r, just create a new instance

`let Auth0r = new Auth0r(connection: any)`

To make things go quicker, you have to pass Knex connection options.  It just plugs them into the query builder.  I will make it easier in the future somehow.

### Middleware
Middleware is accessible by

`Auth0r.middleware()`

so in express, you would 'use' it like

```
let app = express();

...

app.use(Auth0r.middleware);

...
```

Note: in order for Auth0r to be effective, you have to 'use' Auth0r's middleware before anything else.  Express 'uses' sequentially, so if you notice you are sending invalid requests and the API is still returning something, then you probably have an ordering issue.
npm package: @pritesh9/parcel-namer-preserve-structure
Description: Preserves file names and dir structure.
Author: Pritesh Patel
Latest version: 1.2.0

# @pritesh9/parcel-namer-preserve-structure

* Preserves file names and directory structure.
* Only kicks in production mode. Developement mode is skiped as it requires unique names.
* Content hashing is disabled by default.

### Add "namerSourceFolder" section in package.json and specify source directory relative to current working directory.
*Example*: Following line specifies, all source files are located in "src" folder in current working directoy.
```
"namerSourceFolder": "src"
````

### Add "namerContentHash" section in package.json with boolean value to eneble or disable content hash. It is disabled by default.
*Example*: Following line enables content hash and 
```
"namerContentHash": true
````

### Add following to .parcelrc file located in project root directory (next to package.json) to actually use the namer plugin.
```
{
	"extends": "@parcel/config-default",
	"namers": ["@pritesh9/parcel-namer-preserve-structure", "..."]
}
```
npm package: @pritesh9/search
Description: * Very light weight (less than 1 KB). * No dependency. * Easy to use. * Allows configuration.
Author: Pritesh Patel
Latest version: 1.0.0

# search-js
## A simple search library to perform text search in JavaScript.

* Very light weight (less than 1 KB).
* No dependency.
* Easy to use.
* Allows configuration.

### Instructions

To use the library frist you need to import the single function `search` using following import statement.
```
inport { search } from '@pritesh9/search
```

Now you can call the function to get matced objects. Following code requests first 20 matchs.
```
const matchedData = search(data, query, 20)
```

### Notes

The `search` function takes 3 parameters.
1. d: The array of objects. Each object must contain `searchIndex` and `searchScore` fields where searchIndex is a string to search from and it can be manually generated before hand or you can use technique whown in following example. The searchScore field is usually initilized with 0 but you can have some numeric value for bised results.
```
import { search } from '../search.js'

const data = [
    {
        "name": "John Doe",
        "gender": "Male",
        "position": "Manager"
    },
    {
        "name": "Jane Doe",
        "gender": "Female",
        "position": "Supervisor"
    },
    {
        "name": "Steven Demetrius",
        "gender": "Male",
        "position": "Supervisor"
    }
];

let dataWithIndex = [];

for (let i = 0; i < data.length; i++) {
    const o = {
        "searchIndex": (data[i].gender + data[i].position + data[i].name).toLowerCase(),
        "searchScore": 0,
        "result": {...data[i]}
    }
    dataWithIndex.push(o);
}

console.log(search(dataWithIndex, "male doe"), dataWithIndex.length); // returns whole array sortedd by heighest searchScore to lowest.
```
2. q: The query string. By default, matching is case sensite. For case insensitivity, supply searchIndes and query both in same case.
3. n: The number of results you want back (default value is 10). To get whole array back, you can use array.length as a input.

### How does it work? How the searchScore is decided?

* For each word match, 1 point is added to the searchScore along with a value between 0 and 1 based on the position of the matched word.
* More point for matching word is in the begining of the searchIndex and less if matching word is towards the end.
* Number of matching words is favoured more than position in the string.
* Position of words in the query string and white spaces are completely ignored (For eaample, searching for "hello world" and "world hello" have same effect).
* Maximum score for any query is 2 time the number of words in the query string (seperated by a space).