diff --git a/make-arrow-function-1.1.0.tgz b/make-arrow-function-1.1.0.tgz new file mode 100644 index 0000000..96c3c0e Binary files /dev/null and b/make-arrow-function-1.1.0.tgz differ diff --git a/nodejs-make-arrow-function-license.txt b/nodejs-make-arrow-function-license.txt new file mode 100644 index 0000000..3f137ce --- /dev/null +++ b/nodejs-make-arrow-function-license.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (C) 2015 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/nodejs-make-arrow-function-tests.patch b/nodejs-make-arrow-function-tests.patch new file mode 100644 index 0000000..783aba6 --- /dev/null +++ b/nodejs-make-arrow-function-tests.patch @@ -0,0 +1,51 @@ +From cab9a8347a302432e8b01474830c5ea81499ba09 Mon Sep 17 00:00:00 2001 +From: Jordan Harband +Date: Mon, 17 Aug 2015 21:04:11 -0700 +Subject: [PATCH] [Tests] Fixing the tests for node 0.12. + +--- + package.json | 2 +- + test/index.js | 15 +++++++++++---- + 2 files changed, 12 insertions(+), 5 deletions(-) + +diff --git a/package.json b/package.json +index b8e1c60..4a6d638 100644 +--- a/package.json ++++ b/package.json +@@ -6,7 +6,7 @@ + "license": "MIT", + "main": "index.js", + "scripts": { +- "test": "npm run lint && node --harmony test/index.js && npm run security", ++ "test": "npm run lint && node test/index.js && npm run security", + "coverage": "covert test/*.js", + "coverage-quiet": "covert test/*.js --quiet", + "lint": "npm run jscs && npm run eslint", +diff --git a/test/index.js b/test/index.js +index f40312c..6dbcd81 100644 +--- a/test/index.js ++++ b/test/index.js +@@ -21,12 +21,19 @@ test('makeArrowFunction.list() is an array', function (t) { + '() => 42', + '() => function () {}', + '() => x => x * x', +- 'x => x * x' ++ 'x => x * x', ++ 'x => { return x * x; }', ++ '(x, y) => { return x + x; }' + ]; ++ t.plan(1 + 2 * funcs.length); + t.equal(Object.prototype.toString.call(funcs), '[object Array]', 'list() is an array'); +- for (var i = 0; i < funcs.length; ++i) { +- t.equal(typeof funcs[i], 'function', funcs[i] + ' is a function'); +- t.equal(String(funcs[i]), expectedSources[i], '"' + funcs[i] + '" !== "' + expectedSources[i] + '"'); ++ if (funcs.length === 0) { ++ t.comment('no arrow functions present'); ++ } else { ++ for (var i = 0; i < funcs.length; ++i) { ++ t.equal(typeof funcs[i], 'function', funcs[i] + ' is a function'); ++ t.equal(String(funcs[i]), expectedSources[i], '"' + funcs[i] + '" !== "' + expectedSources[i] + '"'); ++ } + } + t.end(); + }); diff --git a/nodejs-make-arrow-function.spec b/nodejs-make-arrow-function.spec new file mode 100644 index 0000000..bae1580 --- /dev/null +++ b/nodejs-make-arrow-function.spec @@ -0,0 +1,45 @@ +%{?nodejs_find_provides_and_requires} +Name: nodejs-make-arrow-function +Version: 1.1.0 +Release: 1 +Summary: Function that returns an arbitrary arrow function +License: MIT +URL: https://github.com/ljharb/make-arrow-function +Source0: https://registry.npmjs.org/make-arrow-function/-/make-arrow-function-%{version}.tgz +# https://github.com/ljharb/make-arrow-function/pull/1 +Source1: nodejs-make-arrow-function-license.txt +# https://github.com/ljharb/make-arrow-function/commit/cab9a8347a302432e8b01474830c5ea81499ba09 +Patch0: nodejs-make-arrow-function-tests.patch +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch +BuildRequires: nodejs-packaging +BuildRequires: npm(tape) +%description +Function that returns an arbitrary arrow function, or undefined +if arrow function syntax is unsupported. + +%prep +%autosetup -p 1 -n package +cp %{SOURCE1} LICENSE +rm -rf node_modules + +%build + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/make-arrow-function +cp -pr package.json index.js %{buildroot}%{nodejs_sitelib}/make-arrow-function +%nodejs_symlink_deps + +%check +%nodejs_symlink_deps --check +%{__nodejs} test/index.js + +%files +%{!?_licensedir:%global license %doc} +%doc README.md CHANGELOG.md +%license LICENSE +%{nodejs_sitelib}/make-arrow-function + +%changelog +* Sat Aug 29 2020 wutao - 1.1.0-1 +- package init