@dmail/uneval
Advanced tools
Comparing version 0.0.1 to 0.1.0
@@ -284,3 +284,3 @@ "use strict"; | ||
new: false, | ||
skipFunctionBody: false, | ||
skipFunctionBody: true, | ||
pretty: true | ||
@@ -287,0 +287,0 @@ }; |
@@ -54,5 +54,5 @@ "use strict"; | ||
var expectUnevalWithoutFunctionBody = function expectUnevalWithoutFunctionBody(value, expectedUneval) { | ||
var expectUnevalWithFunctionBody = function expectUnevalWithFunctionBody(value, expectedUneval) { | ||
return _assert2.default.equal((0, _uneval.uneval)(value, { | ||
skipFunctionBody: true | ||
skipFunctionBody: false | ||
}), expectedUneval); | ||
@@ -72,13 +72,13 @@ }; | ||
ensure("arrow function", function () { | ||
// because of babel most function body are converted back to regular function | ||
expectUneval(function () {}, "function () {}"); | ||
expectUneval(function () { | ||
return true; | ||
}, "function () {\n return true;\n }"); | ||
expectUnevalWithoutFunctionBody(function () {}, "function"); | ||
expectUneval(function () {}, "function"); | ||
var named = function named() {}; | ||
expectUneval(named, "function named() {}"); | ||
expectUnevalWithoutFunctionBody(named, "function named"); | ||
expectUneval(named, "function named"); | ||
expectUnevalWithFunctionBody(named, "function named() {}"); // because of babel most function body are converted back to regular function | ||
expectUnevalWithFunctionBody(function () {}, "function () {}"); | ||
expectUnevalWithFunctionBody(function () { | ||
return true; | ||
}, "function () {\n return true;\n }"); | ||
}); | ||
@@ -85,0 +85,0 @@ ensure("function", function () {// no need, arrow function are enougth |
{ | ||
"name": "@dmail/uneval", | ||
"version": "0.0.1", | ||
"licence": "MIT", | ||
"version": "0.1.0", | ||
"license": "MIT", | ||
"repository": { | ||
@@ -24,5 +24,4 @@ "type": "git", | ||
"@dmail/command": "0.1.1", | ||
"@dmail/prettiest": "0.1.4", | ||
"@dmail/prettiest": "0.2.1", | ||
"@dmail/shared-config": "1.1.1", | ||
"@dmail/test": "0.3.4", | ||
"babel-cli": "7.0.0-beta.0", | ||
@@ -47,2 +46,3 @@ "babel-core": "7.0.0-beta.0", | ||
"test-list": "test-list", | ||
"code-list": "prettiest-list", | ||
"test-before": "npm run code-lint && npm run code-format && npm run code-compile", | ||
@@ -54,11 +54,12 @@ "test-run": "test-run", | ||
"test-cover-html": "nyc report --reporter=lcov", | ||
"test-cover-text": "nyc report --reporter=text-summary", | ||
"test-cover-table": "nyc report --reporter=text", | ||
"test-cover-lcov": "nyc report --reporter=text-lcov > coverage.lcov", | ||
"test-cover-upload": "npm run test-cover-lcov && codecov --token=7e0621a2-dbc9-485d-a150-3870d30ba3ae", | ||
"repo-reset": "npm run code-clean && npm run test-cover-clean && rimraf node_modules", | ||
"repo-reinstall": "npm run repo-reset && npm install", | ||
"build": "npm run code-compile", | ||
"build": "npm run code-build", | ||
"compile": "npm run code-compile", | ||
"prepublishOnly": "npm run code-compile", | ||
"prepublishOnly": "npm run code-build", | ||
"reinstall": "npm run repo-reinstall" | ||
} | ||
} |
@@ -208,3 +208,3 @@ // https://github.com/jsenv/core/blob/959e76068b62c23d7047f6a8c7a3d6582ac25177/src/api/util/uneval.js | ||
new: false, | ||
skipFunctionBody: false, | ||
skipFunctionBody: true, | ||
pretty: true | ||
@@ -211,0 +211,0 @@ } |
@@ -26,4 +26,4 @@ import assert from "assert" | ||
assert.equal(uneval(value, { parenthesis: true, new: true }), expectedUneval) | ||
const expectUnevalWithoutFunctionBody = (value, expectedUneval) => | ||
assert.equal(uneval(value, { skipFunctionBody: true }), expectedUneval) | ||
const expectUnevalWithFunctionBody = (value, expectedUneval) => | ||
assert.equal(uneval(value, { skipFunctionBody: false }), expectedUneval) | ||
@@ -42,5 +42,10 @@ /* eslint-disable no-new-wrappers, no-new-object, no-array-constructor */ | ||
ensure("arrow function", () => { | ||
expectUneval(() => {}, `function`) | ||
const named = () => {} | ||
expectUneval(named, `function named`) | ||
expectUnevalWithFunctionBody(named, `function named() {}`) | ||
// because of babel most function body are converted back to regular function | ||
expectUneval(() => {}, "function () {}") | ||
expectUneval( | ||
expectUnevalWithFunctionBody(() => {}, "function () {}") | ||
expectUnevalWithFunctionBody( | ||
() => true, | ||
@@ -51,6 +56,2 @@ `function () { | ||
) | ||
expectUnevalWithoutFunctionBody(() => {}, `function`) | ||
const named = () => {} | ||
expectUneval(named, `function named() {}`) | ||
expectUnevalWithoutFunctionBody(named, `function named`) | ||
}) | ||
@@ -57,0 +58,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
54345
13
863