open-index/open-npm huggingface dataset:
npm package: @imatyushkin/deep-query
Description: Easy data chains for JavaScript
Author: Igor Matyushkin
Latest version: 0.1.1

<p align="center">
    <a href="https://http://www.android.com">
        <img src="https://img.shields.io/badge/Created for-Node.js-teal.svg?style=flat">
    </a>
    <a href="https://http://www.android.com">
        <img src="https://img.shields.io/badge/Written in-TypeScript-purple.svg?style=flat">
    </a>
    <a href="https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)">
        <img src="https://img.shields.io/badge/License-Apache 2.0-blue.svg?style=flat">
    </a>
</p>

## At a Glance

`DeepQuery.js` solves the problem of null element inside of long object chain.

## How to Get Started

Type in Terminal:

`npm install --save @imatyushkin/deep-query`

or, if you prefer `yarn` over `npm`, type:

`yarn add @imatyushkin/deep-query`

## Usage

### Simple Query

Let's assume we have some JavaScript object with complicated structure of nested objects:

```javascript
var obj = {
    a: {
        b: [
            { val: [1,2,3] },
            { val: [4,5,6] },
            { val: null },
        ]
    }
};
```

Now, we want to obtain a value located very deep in the tree:

```javascript
var regularQuery = obj.a.b[2].val[0] // CRASH 😡
```

We'll get crash because the `val` is `null`, which might be an unexpected case. To avoid this, we could implement a more complicated logic based on data structure:

```javascript
var safeQuery = (() => {
    var intermediateResult = obj.a.b[2];
    return intermediateResult.val ? intermediateResult.val[0] : null;
})();
```

With `DeepQuery.js` it works significantly easier:

```javascript
import "@imatyushkin/deep-query"

var query = obj.__("a.b.2.val.0") // No crash, just null will be returned 🙂
var anotherQuery = obj.__("a.b.1.val.0") // 4
```

### Filter

Here's example of query with data filter:

```javascript
var data = {
    users: [
        {
            name: "John",
            points: [10,9,5]
        },
        {
            name: "Donald",
            points: [8, 4, 2]
        }
    ]
}

var pointsOfJohn = data.__("users.name:John.0.points") // [10, 9, 5]
```

### Multiline Query

For convenience, you may use a multiline expression:

```javascript
// Instead of
var pointsOfJohn = data.__("users.name:John.0.points")

// use
var pointsOfJohn = data.__(`
    users
    .name:John.0
    .points
`)
```

## License

`DeepQuery.js` is available under the Apache 2.0 license. See the [LICENSE](./LICENSE) file for more info.
npm package: @imatyushkin/recognizer
Description: Recognizer identifies users connected to your server with socket. Made for Node.js.
Author: Author
Latest version: 1.1.0

<p align="center">
    <a href="https://http://www.android.com">
        <img src="https://img.shields.io/badge/Created for-Node.js-teal.svg?style=flat">
    </a>
    <a href="https://http://www.android.com">
        <img src="https://img.shields.io/badge/Written in-TypeScript-purple.svg?style=flat">
    </a>
    <a href="https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)">
        <img src="https://img.shields.io/badge/License-Apache 2.0-blue.svg?style=flat">
    </a>
</p>

## At a Glance

`Recognizer` identifies users connected to your server with socket. The library is built on top of [Socket.IO](https://socket.io).

## How to Get Started

If you use `npm`, type in Terminal:

```
npm install --save @imatyushkin/recognizer socket.io
npm install --save-dev @types/socket.io
```

If you prefer `yarn`, type:

```
yarn add @imatyushkin/recognizer socket.io
yarn add @types/socket.io --dev
```

## Usage

`Recognizer` requires SocketIO server instance:

```typescript
const recognizer = new Recognizer({
	socketIO: <Your SocketIO instance>,
	users: {
		onAdded: (user) => {
			// Handle new user
		},
		onEvent: (user, event, data) => {
			// Handle event from user
		},
		onRemoved: (user) => {
			// Handle user's removal
		}
	}
});
```

To add new user, simply send socket to recognizer:

```typescript
recognizer.add(socket);
```

To remove the user, write this:

```typescript
recognizer.remove(socket);
```

## License

`Recognizer` is available under the Apache 2.0 license. See the [LICENSE](./LICENSE) file for more info.