@tko/utils.functionrewrite 4.0.0-beta1.3 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/functionRewrite.js +3 -1
- package/dist/functionRewrite.js.map +2 -2
- package/dist/index.cjs +6 -4
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -3
- package/LICENSE +0 -22
package/dist/functionRewrite.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// @tko/utils.functionrewrite 🥊 4.0.0
|
|
1
|
+
// @tko/utils.functionrewrite 🥊 4.0.0 ESM
|
|
2
|
+
"use strict";
|
|
2
3
|
const FUNCTION_REX = /\bfunction\s*\(([^)]*)\)\s*\{\s*(?:(return\s)?([^}]+?)[;\s]*)?\}/g;
|
|
3
4
|
export default function functionRewrite(bindingString) {
|
|
4
5
|
return bindingString.replace(FUNCTION_REX, (match, args, returnKeyword, rv) => {
|
|
@@ -12,3 +13,4 @@ export default function functionRewrite(bindingString) {
|
|
|
12
13
|
return out;
|
|
13
14
|
});
|
|
14
15
|
}
|
|
16
|
+
functionRewrite.silent = false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/functionRewrite.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * This is a BindingString subclass that converts `function () {}` to lambas,\n * for backwards compatibility.\n *\n */\n\nconst FUNCTION_REX = /\\bfunction\\s*\\(([^)]*)\\)\\s*\\{\\s*(?:(return\\s)?([^}]+?)[;\\s]*)?\\}/g\n\nexport default function functionRewrite
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * This is a BindingString subclass that converts `function () {}` to lambas,\n * for backwards compatibility.\n *\n */\n\nconst FUNCTION_REX = /\\bfunction\\s*\\(([^)]*)\\)\\s*\\{\\s*(?:(return\\s)?([^}]+?)[;\\s]*)?\\}/g\n\nexport default function functionRewrite(bindingString: string): string {\n return bindingString.replace(FUNCTION_REX, (match, args, returnKeyword, rv) => {\n if (rv && !returnKeyword) {\n rv += ' && undefined'\n }\n const out = `(${args.trim()}) => ${rv}`\n if (!functionRewrite.silent) {\n console.log(`Knockout: Replace \"${match}\" with \"${out}\"`)\n }\n return out\n })\n}\n\nfunctionRewrite.silent = false\n"],
|
|
5
|
+
"mappings": ";;AAMA,MAAM,eAAe;AAErB,wBAAwB,gBAAgB,eAA+B;AACrE,SAAO,cAAc,QAAQ,cAAc,CAAC,OAAO,MAAM,eAAe,OAAO;AAC7E,QAAI,MAAM,CAAC,eAAe;AACxB,YAAM;AAAA,IACR;AACA,UAAM,MAAM,IAAI,KAAK,KAAK,CAAC,QAAQ,EAAE;AACrC,QAAI,CAAC,gBAAgB,QAAQ;AAC3B,cAAQ,IAAI,sBAAsB,KAAK,WAAW,GAAG,GAAG;AAAA,IAC1D;AACA,WAAO;AAAA,EACT,CAAC;AACH;AAEA,gBAAgB,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// @tko/utils.functionrewrite 🥊 4.0.0
|
|
1
|
+
// @tko/utils.functionrewrite 🥊 4.0.0 CommonJS
|
|
2
|
+
"use strict";
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -18,11 +19,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
20
|
|
|
20
21
|
// index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
23
24
|
functionRewrite: () => functionRewrite
|
|
24
25
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
27
|
|
|
27
28
|
// src/functionRewrite.ts
|
|
28
29
|
var FUNCTION_REX = /\bfunction\s*\(([^)]*)\)\s*\{\s*(?:(return\s)?([^}]+?)[;\s]*)?\}/g;
|
|
@@ -38,3 +39,4 @@ function functionRewrite(bindingString) {
|
|
|
38
39
|
return out;
|
|
39
40
|
});
|
|
40
41
|
}
|
|
42
|
+
functionRewrite.silent = false;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../index.ts", "../src/functionRewrite.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './src'\n", "/**\n * This is a BindingString subclass that converts `function () {}` to lambas,\n * for backwards compatibility.\n *\n */\n\nconst FUNCTION_REX = /\\bfunction\\s*\\(([^)]*)\\)\\s*\\{\\s*(?:(return\\s)?([^}]+?)[;\\s]*)?\\}/g\n\nexport default function functionRewrite
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export * from './src'\n", "/**\n * This is a BindingString subclass that converts `function () {}` to lambas,\n * for backwards compatibility.\n *\n */\n\nconst FUNCTION_REX = /\\bfunction\\s*\\(([^)]*)\\)\\s*\\{\\s*(?:(return\\s)?([^}]+?)[;\\s]*)?\\}/g\n\nexport default function functionRewrite(bindingString: string): string {\n return bindingString.replace(FUNCTION_REX, (match, args, returnKeyword, rv) => {\n if (rv && !returnKeyword) {\n rv += ' && undefined'\n }\n const out = `(${args.trim()}) => ${rv}`\n if (!functionRewrite.silent) {\n console.log(`Knockout: Replace \"${match}\" with \"${out}\"`)\n }\n return out\n })\n}\n\nfunctionRewrite.silent = false\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMA,IAAM,eAAe;AAEN,SAAR,gBAAiC,eAA+B;AACrE,SAAO,cAAc,QAAQ,cAAc,CAAC,OAAO,MAAM,eAAe,OAAO;AAC7E,QAAI,MAAM,CAAC,eAAe;AACxB,YAAM;AAAA,IACR;AACA,UAAM,MAAM,IAAI,KAAK,KAAK,CAAC,QAAQ,EAAE;AACrC,QAAI,CAAC,gBAAgB,QAAQ;AAC3B,cAAQ,IAAI,sBAAsB,KAAK,WAAW,GAAG,GAAG;AAAA,IAC1D;AACA,WAAO;AAAA,EACT,CAAC;AACH;AAEA,gBAAgB,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.0.0
|
|
2
|
+
"version": "4.0.0",
|
|
3
3
|
"name": "@tko/utils.functionrewrite",
|
|
4
4
|
"description": "Rewrite `function {}` as lambdas (=>)",
|
|
5
5
|
"module": "dist/utils.functionrewrite.js",
|
|
@@ -38,6 +38,5 @@
|
|
|
38
38
|
"repository": {
|
|
39
39
|
"type": "git",
|
|
40
40
|
"url": "git+https://github.com/knockout/tko.git"
|
|
41
|
-
}
|
|
42
|
-
"gitHead": "a8843acb8ae085915115e53a4e057b30731c635e"
|
|
41
|
+
}
|
|
43
42
|
}
|
package/LICENSE
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT) - http://www.opensource.org/licenses/mit-license.php
|
|
2
|
-
|
|
3
|
-
Copyright (c) Steven Sanderson, the Knockout.js team, and other contributors
|
|
4
|
-
http://knockoutjs.com/
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in
|
|
14
|
-
all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
-
THE SOFTWARE.
|