1.0.3 • Published 2 years ago

nv-js-infix-ir v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

nv-js-infix-ir

  • infix binop map-to two-params-simple-lambda
  • for copy/paste in nvlang

install

  • npm install nv-js-infix-ir

usage

APIS

    {
      NAME_TO_OP: {
        add: '+',
        sub: '-',
        div: '/',
        mod: '%',
        mul: '*',
        pow: '**',
        band: '&',
        bor: '|',
        shr: '>>',
        ushr: '>>>',
        shl: '<<',
        bxor: '^',
        eq: '==',
        teq: '===',
        neq: '!=',
        nteq: '!==',
        in: 'in',
        instof: 'instanceof',
        gt: '>',
        lt: '<',
        ge: '>=',
        le: '<=',
        lor: '||',
        land: '&&',
        nc: '??'
      },
      OP_TO_NAME: {
        '+': 'add',
        '-': 'sub',
        '/': 'div',
        '%': 'mod',
        '*': 'mul',
        '**': 'pow',
        '&': 'band',
        '|': 'bor',
        '>>': 'shr',
        '>>>': 'ushr',
        '<<': 'shl',
        '^': 'bxor',
        '==': 'eq',
        '===': 'teq',
        '!=': 'neq',
        '!==': 'nteq',
        in: 'in',
        instanceof: 'instof',
        '>': 'gt',
        '<': 'lt',
        '>=': 'ge',
        '<=': 'le',
        '||': 'lor',
        '&&': 'land',
        '??': 'nc'
      },
      OP_TO_FUNC: {
        '+': [Function: +],
        '-': [Function: -],
        '/': [Function: /],
        '%': [Function: %],
        '*': [Function: *],
        '**': [Function: **],
        '&': [Function: &],
        '|': [Function: |],
        '>>': [Function: >>],
        '>>>': [Function: >>>],
        '<<': [Function: <<],
        '^': [Function: ^],
        '==': [Function: ==],
        '===': [Function: ===],
        '!=': [Function: !=],
        '!==': [Function: !==],
        in: [Function: in],
        instanceof: [Function: instanceof],
        '>': [Function: >],
        '<': [Function: <],
        '>=': [Function: >=],
        '<=': [Function: <=],
        '||': [Function (anonymous)],
        '&&': [Function (anonymous)],
        '??': [Function (anonymous)]
      },
      NAME_TO_FUNC: {
        add: [Function: +],
        sub: [Function: -],
        div: [Function: /],
        mod: [Function: %],
        mul: [Function: *],
        pow: [Function: **],
        band: [Function: &],
        bor: [Function: |],
        shr: [Function: >>],
        ushr: [Function: >>>],
        shl: [Function: <<],
        bxor: [Function: ^],
        eq: [Function: ==],
        teq: [Function: ===],
        neq: [Function: !=],
        nteq: [Function: !==],
        in: [Function: in],
        instof: [Function: instanceof],
        gt: [Function: >],
        lt: [Function: <],
        ge: [Function: >=],
        le: [Function: <=],
        lor: [Function (anonymous)],
        land: [Function (anonymous)],
        nc: [Function (anonymous)]
      },
      OP_TO_FUNC_RTRN_AST: {
        '+': [Function: ast_func],
        '-': [Function: ast_func],
        '/': [Function: ast_func],
        '%': [Function: ast_func],
        '*': [Function: ast_func],
        '**': [Function: ast_func],
        '&': [Function: ast_func],
        '|': [Function: ast_func],
        '>>': [Function: ast_func],
        '>>>': [Function: ast_func],
        '<<': [Function: ast_func],
        '^': [Function: ast_func],
        '==': [Function: ast_func],
        '===': [Function: ast_func],
        '!=': [Function: ast_func],
        '!==': [Function: ast_func],
        in: [Function: ast_func],
        instanceof: [Function: ast_func],
        '>': [Function: ast_func],
        '<': [Function: ast_func],
        '>=': [Function: ast_func],
        '<=': [Function: ast_func],
        '||': [Function (anonymous)],
        '&&': [Function (anonymous)],
        '??': [Function (anonymous)]
      },
      NAME_TO_FUNC_RTRN_AST: {
        add: [Function: ast_func],
        sub: [Function: ast_func],
        div: [Function: ast_func],
        mod: [Function: ast_func],
        mul: [Function: ast_func],
        pow: [Function: ast_func],
        band: [Function: ast_func],
        bor: [Function: ast_func],
        shr: [Function: ast_func],
        ushr: [Function: ast_func],
        shl: [Function: ast_func],
        bxor: [Function: ast_func],
        eq: [Function: ast_func],
        teq: [Function: ast_func],
        neq: [Function: ast_func],
        nteq: [Function: ast_func],
        in: [Function: ast_func],
        instof: [Function: ast_func],
        gt: [Function: ast_func],
        lt: [Function: ast_func],
        ge: [Function: ast_func],
        le: [Function: ast_func],
        lor: [Function (anonymous)],
        land: [Function (anonymous)],
        nc: [Function (anonymous)]
      },
      INCLUDES: 'const ___add = (a,b)=>a+b;\n' +
        'const ___sub = (a,b)=>a-b;\n' +
        'const ___div = (a,b)=>a/b;\n' +
        'const ___mod = (a,b)=>a%b;\n' +
        'const ___mul = (a,b)=>a*b;\n' +
        'const ___pow = (a,b)=>a**b;\n' +
        'const ___band = (a,b)=>a&b;\n' +
        'const ___bor = (a,b)=>a|b;\n' +
        'const ___shr = (a,b)=>a>>b;\n' +
        'const ___ushr = (a,b)=>a>>>b;\n' +
        'const ___shl = (a,b)=>a<<b;\n' +
        'const ___bxor = (a,b)=>a^b;\n' +
        'const ___eq = (a,b)=>a==b;\n' +
        'const ___teq = (a,b)=>a===b;\n' +
        'const ___neq = (a,b)=>a!=b;\n' +
        'const ___nteq = (a,b)=>a!==b;\n' +
        'const ___in = (a,b)=>(a in b);\n' +
        'const ___instof = (a,b)=>(a instanceof b);\n' +
        'const ___gt = (a,b)=>a>b;\n' +
        'const ___lt = (a,b)=>a<b;\n' +
        'const ___ge = (a,b)=>a>=b;\n' +
        'const ___le = (a,b)=>a<=b;\n' +
        'const ___lor=(a,b)=>a||b;\n' +
        'const ___land=(a,b)=>a&&b;\n' +
        'const ___nc=(a,b)=>a??b;',
      ___add: [Function: ___add],
      ___sub: [Function: ___sub],
      ___div: [Function: ___div],
      ___mod: [Function: ___mod],
      ___mul: [Function: ___mul],
      ___pow: [Function: ___pow],
      ___band: [Function: ___band],
      ___bor: [Function: ___bor],
      ___shr: [Function: ___shr],
      ___ushr: [Function: ___ushr],
      ___shl: [Function: ___shl],
      ___bxor: [Function: ___bxor],
      ___eq: [Function: ___eq],
      ___teq: [Function: ___teq],
      ___neq: [Function: ___neq],
      ___nteq: [Function: ___nteq],
      ___in: [Function: ___in],
      ___instof: [Function: ___instof],
      ___gt: [Function: ___gt],
      ___lt: [Function: ___lt],
      ___ge: [Function: ___ge],
      ___le: [Function: ___le],
      ___lor: [Function: ___lor],
      ___land: [Function: ___land],
      ___nc: [Function: ___nc],
      OP_TO_CALL_AST: {
        '+': [Function: ast],
        '-': [Function: ast],
        '/': [Function: ast],
        '%': [Function: ast],
        '*': [Function: ast],
        '**': [Function: ast],
        '&': [Function: ast],
        '|': [Function: ast],
        '>>': [Function: ast],
        '>>>': [Function: ast],
        '<<': [Function: ast],
        '^': [Function: ast],
        '==': [Function: ast],
        '===': [Function: ast],
        '!=': [Function: ast],
        '!==': [Function: ast],
        in: [Function: ast],
        instanceof: [Function: ast],
        '>': [Function: ast],
        '<': [Function: ast],
        '>=': [Function: ast],
        '<=': [Function: ast],
        '||': [Function (anonymous)],
        '&&': [Function (anonymous)],
        '??': [Function (anonymous)]
      },
      NAME_TO_CALL_AST: {
        add: [Function: ast],
        sub: [Function: ast],
        div: [Function: ast],
        mod: [Function: ast],
        mul: [Function: ast],
        pow: [Function: ast],
        band: [Function: ast],
        bor: [Function: ast],
        shr: [Function: ast],
        ushr: [Function: ast],
        shl: [Function: ast],
        bxor: [Function: ast],
        eq: [Function: ast],
        teq: [Function: ast],
        neq: [Function: ast],
        nteq: [Function: ast],
        in: [Function: ast],
        instof: [Function: ast],
        gt: [Function: ast],
        lt: [Function: ast],
        ge: [Function: ast],
        le: [Function: ast],
        lor: [Function (anonymous)],
        land: [Function (anonymous)],
        nc: [Function (anonymous)]
      }
    }

LICENSE

  • ISC