@tko/utils.functionrewrite 4.0.0-alpha7.4 → 4.0.0-beta1.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/LICENSE ADDED
@@ -0,0 +1,22 @@
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.
@@ -0,0 +1,14 @@
1
+ // @tko/utils.functionrewrite 🥊 4.0.0-beta1.0 ESM
2
+ const FUNCTION_REX = /\bfunction\s*\(([^)]*)\)\s*\{\s*(?:(return\s)?([^}]+?)[;\s]*)?\}/g;
3
+ export default function functionRewrite(bindingString) {
4
+ return bindingString.replace(FUNCTION_REX, (match, args, returnKeyword, rv) => {
5
+ if (rv && !returnKeyword) {
6
+ rv += " && undefined";
7
+ }
8
+ const out = `(${args.trim()}) => ${rv}`;
9
+ if (!functionRewrite.silent) {
10
+ console.log(`Knockout: Replace "${match}" with "${out}"`);
11
+ }
12
+ return out;
13
+ });
14
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 (bindingString) {\n return bindingString\n .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"],
5
+ "mappings": ";AAMA,MAAM,eAAe;AAErB,wCAAyC,eAAe;AACtD,SAAO,cACJ,QAAQ,cAAc,CAAC,OAAO,MAAM,eAAe,OAAO;AACzD,QAAI,MAAM,CAAC,eAAe;AACxB,YAAM;AAAA,IACR;AACA,UAAM,MAAM,IAAI,KAAK,KAAK,SAAS;AACnC,QAAI,CAAC,gBAAgB,QAAQ;AAC3B,cAAQ,IAAI,sBAAsB,gBAAgB,MAAM;AAAA,IAC1D;AACA,WAAO;AAAA,EACX,CAAC;AACH;",
6
+ "names": []
7
+ }
package/dist/index.cjs ADDED
@@ -0,0 +1,40 @@
1
+ // @tko/utils.functionrewrite 🥊 4.0.0-beta1.0 CommonJS
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // index.ts
21
+ var utils_exports = {};
22
+ __export(utils_exports, {
23
+ functionRewrite: () => functionRewrite
24
+ });
25
+ module.exports = __toCommonJS(utils_exports);
26
+
27
+ // src/functionRewrite.ts
28
+ var FUNCTION_REX = /\bfunction\s*\(([^)]*)\)\s*\{\s*(?:(return\s)?([^}]+?)[;\s]*)?\}/g;
29
+ function functionRewrite(bindingString) {
30
+ return bindingString.replace(FUNCTION_REX, (match, args, returnKeyword, rv) => {
31
+ if (rv && !returnKeyword) {
32
+ rv += " && undefined";
33
+ }
34
+ const out = `(${args.trim()}) => ${rv}`;
35
+ if (!functionRewrite.silent) {
36
+ console.log(`Knockout: Replace "${match}" with "${out}"`);
37
+ }
38
+ return out;
39
+ });
40
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 (bindingString) {\n return bindingString\n .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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMA,IAAM,eAAe;AAEN,yBAA0B,eAAe;AACtD,SAAO,cACJ,QAAQ,cAAc,CAAC,OAAO,MAAM,eAAe,OAAO;AACzD,QAAI,MAAM,CAAC,eAAe;AACxB,YAAM;AAAA,IACR;AACA,UAAM,MAAM,IAAI,KAAK,KAAK,SAAS;AACnC,QAAI,CAAC,gBAAgB,QAAQ;AAC3B,cAAQ,IAAI,sBAAsB,gBAAgB,MAAM;AAAA,IAC1D;AACA,WAAO;AAAA,EACX,CAAC;AACH;",
6
+ "names": []
7
+ }
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ // @tko/utils.functionrewrite 🥊 4.0.0-beta1.0 ESM
2
+ export { default as functionRewrite } from "./functionRewrite";
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["export { default as functionRewrite } from './functionRewrite'\n"],
5
+ "mappings": ";AAAA;",
6
+ "names": []
7
+ }
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ // @tko/utils.functionrewrite 🥊 4.0.0-beta1.0 MJS
2
+ export { default as functionRewrite } from "./functionRewrite";
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["export { default as functionRewrite } from './functionRewrite'\n"],
5
+ "mappings": ";AAAA;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
+ "version": "4.0.0-beta1.0",
2
3
  "name": "@tko/utils.functionrewrite",
3
- "version": "4.0.0-alpha7.4",
4
4
  "description": "Rewrite `function {}` as lambdas (=>)",
5
5
  "module": "dist/utils.functionrewrite.js",
6
6
  "files": [
7
- "dist/"
7
+ "dist/",
8
+ "helpers/"
8
9
  ],
9
10
  "license": "MIT",
10
11
  "dependencies": {
11
- "tslib": "^1.8.0"
12
+ "tslib": "^2.2.0"
12
13
  },
13
14
  "karma": {
14
15
  "frameworks": [
@@ -16,28 +17,27 @@
16
17
  "chai"
17
18
  ]
18
19
  },
19
- "__about__shared.package.json": "These properties are copied into all packages/*/package.json. Run `yarn repackage`",
20
- "standard": {
21
- "env": [
22
- "browser",
23
- "jasmine",
24
- "mocha"
25
- ]
26
- },
27
- "scripts": {
28
- "test": "karma start ../../karma.conf.js --once",
29
- "build": "rollup -c ../../rollup.config.js",
30
- "watch": "karma start ../../karma.conf.js",
31
- "prepare": "rollup -c ../../rollup.config.js"
32
- },
33
- "publishConfig": {
34
- "access": "public"
35
- },
36
20
  "homepage": "https://tko.io",
37
21
  "licenses": [
38
22
  {
39
23
  "type": "MIT",
40
- "url": "http://www.opensource.org/licenses/mit-license.php"
24
+ "url": "https://opensource.org/licenses/MIT"
41
25
  }
42
- ]
26
+ ],
27
+ "exports": {
28
+ ".": {
29
+ "require": "./dist/index.cjs",
30
+ "import": "./dist/index.js"
31
+ },
32
+ "./helpers/*": "./helpers/*"
33
+ },
34
+ "bugs": {
35
+ "url": "https://github.com/knockout/tko/issues"
36
+ },
37
+ "author": "The Knockout Team",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/knockout/tko.git"
41
+ },
42
+ "gitHead": "99114c4deded3fc5dbddd5c7c9c63c845a18263b"
43
43
  }
@@ -1,25 +0,0 @@
1
- /*!
2
- * Rewrite `function {}` as lambdas (=>) 🥊 @tko/utils.functionrewrite@4.0.0-alpha7.4
3
- * (c) The Knockout.js Team - https://tko.io
4
- * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
- */
6
-
7
- /**
8
- * This is a BindingString subclass that converts `function () {}` to lambas,
9
- * for backwards compatibility.
10
- *
11
- */
12
-
13
- const FUNCTION_REX = /\bfunction\s*\(([^)]*)\)\s*{\s*(?:return\s+([^}]+?)\s*)?}/g;
14
-
15
- function functionRewrite (bindingString) {
16
- return bindingString.replace(FUNCTION_REX, (match, args, rv) => {
17
- if (!functionRewrite.silent) {
18
- console.log(`Knockout: Replace "${match}" with "=> ${rv}"`);
19
- }
20
- return `(${args.trim()}) => ${rv}`
21
- })
22
- }
23
-
24
- export { functionRewrite };
25
- //# sourceMappingURL=utils.functionrewrite.es6.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.functionrewrite.es6.js","sources":["../src/functionRewrite.js"],"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) {\n return bindingString.replace(FUNCTION_REX, (match, args, rv) => {\n if (!functionRewrite.silent) {\n console.log(`Knockout: Replace \"${match}\" with \"=> ${rv}\"`)\n }\n return `(${args.trim()}) => ${rv}`\n })\n}\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;AAMA,MAAM,YAAY,GAAG,6DAA4D;;AAEjF,SAAwB,eAAe,EAAE,aAAa,EAAE;EACtD,OAAO,aAAa,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK;IAC9D,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;MAC3B,OAAO,CAAC,GAAG,CAAC,CAAC,mBAAmB,EAAE,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,EAAC;KAC5D;IACD,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;GACnC,CAAC;CACH;;"}
@@ -1,23 +0,0 @@
1
- /*!
2
- * Rewrite `function {}` as lambdas (=>) 🥊 @tko/utils.functionrewrite@4.0.0-alpha7.4
3
- * (c) The Knockout.js Team - https://tko.io
4
- * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
- */
6
-
7
- /**
8
- * This is a BindingString subclass that converts `function () {}` to lambas,
9
- * for backwards compatibility.
10
- *
11
- */
12
- var FUNCTION_REX = /\bfunction\s*\(([^)]*)\)\s*{\s*(?:return\s+([^}]+?)\s*)?}/g;
13
- function functionRewrite(bindingString) {
14
- return bindingString.replace(FUNCTION_REX, function (match, args, rv) {
15
- if (!functionRewrite.silent) {
16
- console.log("Knockout: Replace \"" + match + "\" with \"=> " + rv + "\"");
17
- }
18
- return "(" + args.trim() + ") => " + rv;
19
- });
20
- }
21
-
22
- export { functionRewrite };
23
- //# sourceMappingURL=utils.functionrewrite.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.functionrewrite.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}