open-index/open-npm huggingface dataset:
npm package: @gisce/conscheck
Description: A JavaScript library for evaluating JSON-based conditions. It allows complex conditional logic to be defined and interpreted from JSON structures, enabling dynamic decision-making in applications.
Author: GISCE-TI, S.L.
Latest version: 1.1.0

# @gisce/conscheck

`@gisce/conscheck` is a versatile TypeScript library for evaluating JSON-based conditions in JavaScript. It allows the definition of complex conditional logic to be interpreted from JSON structures, enabling dynamic and flexible decision-making within applications.

## Features

- Evaluate conditions defined in JSON format.
- Support for both simple and nested conditions.
- Operators include '=', '>=', '<=', '>', '<', and '!='.
- Compatible with both client-side and server-side JavaScript.

## Installation

To install the library, use npm:

```bash
npm install @gisce/conscheck
```

## Usage

Here is a basic example of how to use `@gisce/conscheck`:

```typescript
import { evaluateCondition } from "@gisce/conscheck";

const condition = {
  condition: "AND",
  rules: [
    {
      field: "age",
      operator: ">=",
      value: 18,
    },
    {
      field: "citizenship",
      operator: "=",
      value: true,
    },
  ],
};

const object = { age: 20, citizenship: true };

const result = evaluateCondition({ object, condition });
console.log(result); // Output: true
```

### Nested Conditions

`@gisce/conscheck` also supports nested conditions. Here's an example:

```typescript
const nestedCondition = {
  condition: "OR",
  rules: [
    {
      condition: "AND",
      rules: [
        {
          field: "age",
          operator: ">=",
          value: 65,
        },
        {
          field: "retired",
          operator: "=",
          value: true,
        },
      ],
    },
    {
      field: "age",
      operator: "<",
      value: 18,
    },
  ],
};

const object = { age: 70, retired: true };

const nestedResult = evaluateCondition({ object, condition: nestedCondition });
console.log(nestedResult); // Output: true
```

### Optional `evaluateFieldComparison` Function

You can pass a function to `evaluateCondition` to modify the default field comparison behaviour. This function will be called for each field comparison in the condition, and has the following signature:

```typescript
function evaluateFieldComparison({
  fieldName,
  valueInObject,
  expectedValue,
}: FieldComparisonParams): FieldComparisonResult;
```

The function should return a `FieldComparisonResult` object, which has the following structure:

```typescript
interface FieldComparisonResult {
  modifiedValueInObject?: any;
  modifiedExpectedValue?: any;
  directOutcome?: boolean;
}
```

## Contributing

Contributions to `@gisce/conscheck` are welcome. Please feel free to submit pull requests or open issues to improve the library.

## License

This project is licensed under the MIT License - see the LICENSE file for details.
npm package: @gisce/powerp.js
Description: PowERP Javascript Client
Author: GISCE-TI, S.L.
Latest version: 2.15.1

# PowERP.js

A TypeScript implementation for a PowERP client.

## Install

For the moment you can install this library adding the specific git repository in your `package.json` dependencies, like this:

_package.json_

```json
{
  // ...
  "dependencies": {
    // ...
    "powerp.js": "git://github.com/gisce/powerp.js.git#feature/typescript"
  }
}
```

## Usage

```javascript
import { Client } from "powerp.js";

// ...

const c = new Client({
    host: process.env.ERP_HOST!,
    database: process.env.ERP_DB!,
});

const token = await c.loginAndGetToken({
    user: process.env.ERP_USER!,
    password: process.env.ERP_PASSWORD!,
});
```

## Running tests

First adjust your `.env` file in order to fulfill the proper host, database and auth details. You can get an example copy from `.env.sample`.

Then install the dependencies with:

```shell
$ npm install
```

And therefore you can run the tests using:

```shell
$ npm test
```

## Publishing new versions of the library

If you make any changes in this library and want to use them in your project, you must build it in order to get the updated version:

```shell
$ npm run build
```

This will erase your `dist/` folder and rebuild the library in it. You must push these updated `dist/` files into git.

Then in your project you can simply:

```shell
$ npm update powerp.js
```

## TODO

[ ] Implement pending methods from the old version
[ ] Improve the way to publish this library. NPM public registry?