polished
Version:
A lightweight toolset for writing styles in Javascript.
162 lines (161 loc) • 3.05 kB
JavaScript
exports.__esModule = true;
exports["default"] = void 0;
function last() {
var _ref;
return _ref = arguments.length - 1, _ref < 0 || arguments.length <= _ref ? undefined : arguments[_ref];
}
function negation(a) {
return -a;
}
function addition(a, b) {
return a + b;
}
function subtraction(a, b) {
return a - b;
}
function multiplication(a, b) {
return a * b;
}
function division(a, b) {
return a / b;
}
function max() {
return Math.max.apply(Math, arguments);
}
function min() {
return Math.min.apply(Math, arguments);
}
function comma() {
return Array.of.apply(Array, arguments);
}
var defaultSymbols = {
symbols: {
'*': {
infix: {
symbol: '*',
f: multiplication,
notation: 'infix',
precedence: 4,
rightToLeft: 0,
argCount: 2
},
symbol: '*',
regSymbol: '\\*'
},
'/': {
infix: {
symbol: '/',
f: division,
notation: 'infix',
precedence: 4,
rightToLeft: 0,
argCount: 2
},
symbol: '/',
regSymbol: '/'
},
'+': {
infix: {
symbol: '+',
f: addition,
notation: 'infix',
precedence: 2,
rightToLeft: 0,
argCount: 2
},
prefix: {
symbol: '+',
f: last,
notation: 'prefix',
precedence: 3,
rightToLeft: 0,
argCount: 1
},
symbol: '+',
regSymbol: '\\+'
},
'-': {
infix: {
symbol: '-',
f: subtraction,
notation: 'infix',
precedence: 2,
rightToLeft: 0,
argCount: 2
},
prefix: {
symbol: '-',
f: negation,
notation: 'prefix',
precedence: 3,
rightToLeft: 0,
argCount: 1
},
symbol: '-',
regSymbol: '-'
},
',': {
infix: {
symbol: ',',
f: comma,
notation: 'infix',
precedence: 1,
rightToLeft: 0,
argCount: 2
},
symbol: ',',
regSymbol: ','
},
'(': {
prefix: {
symbol: '(',
f: last,
notation: 'prefix',
precedence: 0,
rightToLeft: 0,
argCount: 1
},
symbol: '(',
regSymbol: '\\('
},
')': {
postfix: {
symbol: ')',
f: undefined,
notation: 'postfix',
precedence: 0,
rightToLeft: 0,
argCount: 1
},
symbol: ')',
regSymbol: '\\)'
},
min: {
func: {
symbol: 'min',
f: min,
notation: 'func',
precedence: 0,
rightToLeft: 0,
argCount: 1
},
symbol: 'min',
regSymbol: 'min\\b'
},
max: {
func: {
symbol: 'max',
f: max,
notation: 'func',
precedence: 0,
rightToLeft: 0,
argCount: 1
},
symbol: 'max',
regSymbol: 'max\\b'
}
}
};
var _default = exports["default"] = defaultSymbols;
module.exports = exports.default;
;