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

json-logic-editor

v10.0.2

Published

| ngx-bootstrap | Angular | Bootstrap CSS | | ------------- | --------------- | ----------------------- | | 8.0.0 | 12.x.x - 13.x.x | 5.x.x or 4.x.x or 3.x.x | | 7.1.0 | 11.x.x - 12.x.x | 5.x.x or 4.x.x or 3.x.x | | 7

Downloads

86

Readme

JsonLogicEditor

Install and Imports

Step 1 Install :

ngx-bootstrap

| ngx-bootstrap | Angular | Bootstrap CSS | | ------------- | --------------- | ----------------------- | | 8.0.0 | 12.x.x - 13.x.x | 5.x.x or 4.x.x or 3.x.x | | 7.1.0 | 11.x.x - 12.x.x | 5.x.x or 4.x.x or 3.x.x | | 7.0.0 | 11.x.x - 12.x.x | 3.x.x or 4.x.x | | 6.0.0 | 9.x.x - 10.x.x | 3.x.x or 4.x.x | | 5.6.x | 7.x.x - 9.1.0 | 3.x.x or 4.x.x | | 5.0.0 - 5.6.0 | 7.x.x - 8.x.x | 3.x.x or 4.x.x | | 4.x.x | 6.x.x - 7.x.x | 3.x.x or 4.x.x | | 3.x.x | 6.x.x - 7.x.x | 3.x.x or 4.x.x | | 2.x.x | 2.x.x - 4.x.x | 3.x.x or 4.x.x | | 1.x.x | 2.x.x | 3.x.x or 4.x.x |

npm install ngx-bootstrap --save

Ng-Select

npm install --save @ng-select/ng-select

Step 2: Include a theme:

style.css: @import "~@ng-select/ng-select/themes/default.theme.css";

Step 3: Add this bootsrap link to your index.html :

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We">
<link rel="stylesheet" href="https://unpkg.com/ngx-bootstrap/datepicker/bs-datepicker.css">

Step 4: Import the JsonLogicEditorModule in App module:

import { JsonLogicEditorModule } from "projects/json-logic-editor/src/public-api";
@NgModule({
  declarations: [AppComponent],
  imports: [JsonLogicEditorModule,NgSelectModule, BsDatepickerModule.forRoot(),]

  providers: [],
  bootstrap: [AppComponent],
})
export class AppModule {}

Step 5: App Module.html

<jsonlogic-expression-editor
  [jsonLogic]="logic"
  [functions]="functions"
  [variables]="variables"
></jsonlogic-expression-editor>

Component Inputs:

jsonLogic :

[jsonLogic]="{"and":[{"==":[{"cat":["Hello ","World"]},"Hello World"]}]}"

[functions] :

import { ICheckExpressionFieldLookUp } from 'json-logic-editor';
functions: ICheckExpressionFieldLookUp[];

[variables] :

import { ICheckExpressionFieldLookUp } from 'json-logic-editor';
variables :ICheckExpressionFieldLookUp[];

Interface

export interface ICheckExpressionFieldLookUp {
  label?: string;
  name?: string;
  value: any;
  type: string | null | undefined;  //  it will be null if  controlerType is "function" And it will not be null if  controlerType is "variable" or "value"
  controlType?: string;   //  it will be "function" ,"variable", "value" only
  returnType?: string;      //  it will be null if the controllerType is  "variable" or "value"  and  it will not be null if  controlerType is "function"
  padding?: number;
  parameters?: ICheckExpressionFieldLookUp[];
}

Example


functions:ICheckExpressionFieldLookUp[];
variables:ICheckExpressionFieldLookUp[];


@ViewChild('jsonEditor') jsonEditor : JsonlogicExpressionEditorComponent ;
logic='';
this.functions = [
  {
    name: "substring",

    controlType: "function",

    type: null,

    returnType: "string",

    parameters: [
      {
        name: "string",

        type: "string",

        controlType: null,

        returnType: null,

        parameters: null,
      },

      {
        name: "number",

        type: "number",

        returnType: null,

        controlType: null,

        parameters: null,
      },

      {
        name: "length?",

        type: "number",

        returnType: null,

        controlType: null,

        parameters: null,
      },
    ],
  },

  {
    name: "floor",

    returnType: "number",

    controlType: "function",

    type: null,

    parameters: [
      {
        name: "number",

        type: "number",

        controlType: null,

        parameters: null,

        returnType: null,
      },
    ],
  },

  {
    name: "cat",

    returnType: "string",

    controlType: "function",

    type: null,

    parameters: [
      {
        name: "string1",

        type: "string",

        controlType: null,

        parameters: null,

        returnType: null,
      },

      {
        name: "string2",

        type: "string",

        controlType: null,

        parameters: null,

        returnType: null,
      },
    ],
  },
];

this.variables = [
  {
    label: "variable1",

    name: "variable1",

    value: "variable1",

    type: "string",

    controlType: "variable",

    returnType: null,

    padding: 0,

    parameters: null,
  },

  {
    label: "variable2",

    name: "variable2",

    value: "variable2",

    type: "string",

    controlType: "variable",

    returnType: null,

    padding: 0,

    parameters: null,
  },

  {
    label: "variable3",

    name: "variable3",

    value: "variable3",

    type: "string",

    controlType: "variable",

    returnType: null,

    padding: 0,

    parameters: null,
  },
];


getJsonLogic()
{
   console.log( this.jsonEditor.getJsonLogic());
}

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.