@aiot-toolkit/card-expression
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -7,7 +7,7 @@ /** | ||
*/ | ||
export default function translateJsToCardCode(source: string): string; | ||
export default function jsToCardCode(source: string): string; | ||
/** | ||
* 转换`模板表达式`为`卡片代码` | ||
* | ||
* @example translateTemplateValueToJsCardCode("a+b {{a+b}}") | ||
* @example translateTemplateValueToCardCode("a+b {{a+b}}") | ||
* | ||
@@ -17,2 +17,2 @@ * @param source | ||
*/ | ||
export declare function translateTemplateValueToJsCardCode(source: string): any; | ||
export declare function templateValueToCardCode(source: string): any; |
@@ -7,7 +7,7 @@ /** | ||
*/ | ||
export default function translateJsToCardCode(source: string): string; | ||
export default function jsToCardCode(source: string): string; | ||
/** | ||
* 转换`模板表达式`为`卡片代码` | ||
* | ||
* @example translateTemplateValueToJsCardCode("a+b {{a+b}}") | ||
* @example translateTemplateValueToCardCode("a+b {{a+b}}") | ||
* | ||
@@ -17,2 +17,2 @@ * @param source | ||
*/ | ||
export declare function translateTemplateValueToJsCardCode(source: string): any; | ||
export declare function templateValueToCardCode(source: string): any; |
@@ -16,3 +16,3 @@ 'use strict'; | ||
*/ | ||
function translateJsToCardCode(source) { | ||
function jsToCardCode(source) { | ||
const jsNode = new JsExpressionParser().parser(source); | ||
@@ -29,3 +29,3 @@ if (!jsNode) { | ||
* | ||
* @example translateTemplateValueToJsCardCode("a+b {{a+b}}") | ||
* @example translateTemplateValueToCardCode("a+b {{a+b}}") | ||
* | ||
@@ -35,5 +35,5 @@ * @param source | ||
*/ | ||
function translateTemplateValueToJsCardCode(source) { | ||
function templateValueToCardCode(source) { | ||
const jsCode = translateExpressionToJsCode(source); | ||
return translateJsToCardCode(jsCode); | ||
return jsToCardCode(jsCode); | ||
} | ||
@@ -56,3 +56,3 @@ function translateExpressionToJsCode(source) { | ||
exports.default = translateJsToCardCode; | ||
exports.translateTemplateValueToJsCardCode = translateTemplateValueToJsCardCode; | ||
exports.default = jsToCardCode; | ||
exports.templateValueToCardCode = templateValueToCardCode; |
{ | ||
"name": "@aiot-toolkit/card-expression", | ||
"description": "快应用卡片表达式解析库", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "module": "es/index.js", |
@@ -28,5 +28,5 @@ # 快应用卡片表达式解析 | ||
```js | ||
import { translateTemplateValueToJsCardCode } from '@aiot-toolkit/card-expression'; | ||
import { templateValueToCardCode } from '@aiot-toolkit/card-expression'; | ||
const result = translateTemplateValueToJsCardCode('a+b{{a+b}}'); | ||
const result = templateValueToCardCode('a+b{{a+b}}'); | ||
console.log(result); // ["+","a+b",["+",["$","a"],["$","b"]]] | ||
@@ -38,5 +38,5 @@ ``` | ||
```js | ||
import translateJsToCardCode from '@aiot-toolkit/card-expression'; | ||
import jsToCardCode from '@aiot-toolkit/card-expression'; | ||
const result = translateJsToCardCode('a+b'); | ||
const result = jsToCardCode('a+b'); | ||
console.log(result); // '["+", ["$", "a"], ["$", "b"]]' | ||
@@ -43,0 +43,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
38366