pax_global_header00006660000000000000000000000064136137010610014510gustar00rootroot0000000000000052 comment=df9f516dd7ee74d3459ee02ff7ca90c45d44874d make-arrow-function-1.2.0/000077500000000000000000000000001361370106100154005ustar00rootroot00000000000000make-arrow-function-1.2.0/.editorconfig000066400000000000000000000004241361370106100200550ustar00rootroot00000000000000root = true [*] indent_style = tab; insert_final_newline = true; quote_type = auto; space_after_anonymous_functions = true; space_after_control_statements = true; spaces_around_operators = true; trim_trailing_whitespace = true; spaces_in_brackets = false; end_of_line = lf; make-arrow-function-1.2.0/.eslintrc000066400000000000000000000002651361370106100172270ustar00rootroot00000000000000{ "root": true, "extends": "@ljharb", "rules": { "no-new-func": [0] }, "overrides": [ { "files": "test/**", "rules": { "no-magic-numbers": 0, }, }, ], } make-arrow-function-1.2.0/.github/000077500000000000000000000000001361370106100167405ustar00rootroot00000000000000make-arrow-function-1.2.0/.github/workflows/000077500000000000000000000000001361370106100207755ustar00rootroot00000000000000make-arrow-function-1.2.0/.github/workflows/rebase.yml000066400000000000000000000003721361370106100227630ustar00rootroot00000000000000name: Automatic Rebase on: [pull_request] jobs: _: name: "Automatic Rebase" runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: ljharb/rebase@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} make-arrow-function-1.2.0/.gitignore000066400000000000000000000001551361370106100173710ustar00rootroot00000000000000# gitignore node_modules # Only apps should have lockfiles npm-shrinkwrap.json package-lock.json yarn.lock make-arrow-function-1.2.0/.npmrc000066400000000000000000000000671361370106100165230ustar00rootroot00000000000000package-lock=false allow-same-version=true message=v%s make-arrow-function-1.2.0/.nvmrc000066400000000000000000000000051361370106100165210ustar00rootroot00000000000000node make-arrow-function-1.2.0/.travis.yml000066400000000000000000000004351361370106100175130ustar00rootroot00000000000000version: ~> 1.0 language: node_js os: - linux import: - ljharb/travis-ci:node/all.yml - ljharb/travis-ci:node/pretest.yml - ljharb/travis-ci:node/posttest.yml - ljharb/travis-ci:node/coverage.yml matrix: allow_failures: - env: COVERAGE=true # temporarily allow this to fail make-arrow-function-1.2.0/CHANGELOG.md000066400000000000000000000324171361370106100172200ustar00rootroot00000000000000# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). ## [v1.2.0](https://github.com/ljharb/make-arrow-function/compare/v1.1.0...v1.2.0) - 2020-01-28 ### Merged - [Docs] Add license text [`#1`](https://github.com/ljharb/make-arrow-function/pull/1) ### Commits - [Tests] use shared travis-ci configs [`a2dbb15`](https://github.com/ljharb/make-arrow-function/commit/a2dbb154ccdbf9ade0287665e1358eaa357aeca0) - [Tests] remove `jscs` [`47362d9`](https://github.com/ljharb/make-arrow-function/commit/47362d97b7e54fdff46954c3a1c24cb4a822422b) - [Tests] up to `node` `v8.4`, `v7.10`, `v6.11`, `v4.8`; newer npm breaks on older node; improve matrix. [`7d9c76d`](https://github.com/ljharb/make-arrow-function/commit/7d9c76dd198a53af177f8527fab57789c0967a70) - [Tests] up to `node` `v12.11`, `v11.15`, `v10.16`, `v8.16`, `v6.17` [`42b5df9`](https://github.com/ljharb/make-arrow-function/commit/42b5df9a3ac2742f8f936d0c36783ac0ec518b8f) - [meta] add `auto-changelog` [`98573fe`](https://github.com/ljharb/make-arrow-function/commit/98573fe13fa03c07280fdeffe45d9ca097a237dd) - [Tests] up to `node` `v11.1`, `v10.13`, `v9.11`, `v8.12`, `v6.14`, `v4.9`; use `nvm install-latest-npm` [`bda106c`](https://github.com/ljharb/make-arrow-function/commit/bda106c03ff5acf3bd5f3af608240bab85b667cc) - [Tests] up to `node` `v9.3`, `v8.9`, `v6.12`; use `nvm install-latest-npm`; pin included builds to LTS [`4ec5c2d`](https://github.com/ljharb/make-arrow-function/commit/4ec5c2df1239c5bbb4c7ed7957164fad927cf3d0) - [Breaking] add more complex arrow functions to the list, with non-simple parameter lists [`121cd07`](https://github.com/ljharb/make-arrow-function/commit/121cd07966a025fb2ce6e5aa1565cdbf73432b09) - [Tests] up to `node` `v7.0`, `v6.9`, `v4.6`; improve test matrix [`f91282e`](https://github.com/ljharb/make-arrow-function/commit/f91282e566ce9035d2f2c37fed1cdc78bef837db) - [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config`, `nsp` [`5fbfc69`](https://github.com/ljharb/make-arrow-function/commit/5fbfc698cbeb7da9a85d3f30252242772c75e3a9) - [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config`, `nsp` [`74af4f3`](https://github.com/ljharb/make-arrow-function/commit/74af4f3c2b593d6d0f1c36945a41363841b32988) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`5c202b1`](https://github.com/ljharb/make-arrow-function/commit/5c202b1cfa2e451c5f569367606f392acee72b43) - Add license text [`e5d6698`](https://github.com/ljharb/make-arrow-function/commit/e5d669882c7eae797e3d0b3104c2c3d00b750292) - [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`f8bb7a9`](https://github.com/ljharb/make-arrow-function/commit/f8bb7a9080e6d7a4b0a4fb1d7a56270e97cd7a3d) - [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config`, `nsp` [`b27f7ee`](https://github.com/ljharb/make-arrow-function/commit/b27f7ee0cb6b8e81603da9401febd607887ae5cb) - [Dev Deps] update `tape`, `jscs`, eslint`, `nsp` [`58a2d0e`](https://github.com/ljharb/make-arrow-function/commit/58a2d0eb842f695a3f5fd6645a74c69c48e6dbe5) - [Tests] Fixing the tests for node 0.12. [`cab9a83`](https://github.com/ljharb/make-arrow-function/commit/cab9a8347a302432e8b01474830c5ea81499ba09) - [Dev Deps] update `jscs`, `eslint`, `nsp` [`5afb885`](https://github.com/ljharb/make-arrow-function/commit/5afb88561a8ce408e7d37d35af488569f61ad15a) - [actions] add automatic rebasing / merge commit blocking [`5620d1b`](https://github.com/ljharb/make-arrow-function/commit/5620d1b793338a4181c98bed15a2c482caec7a2e) - [Tests] up to `v5.6`, `v4.3` [`308f593`](https://github.com/ljharb/make-arrow-function/commit/308f593f134500aaf971490f1c09b3cd4fe227e5) - [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config`, `nsp` [`99f9eeb`](https://github.com/ljharb/make-arrow-function/commit/99f9eeb6a077d7c41e5352acbe1170aa46929e00) - [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`561d1e5`](https://github.com/ljharb/make-arrow-function/commit/561d1e5a264e56fa07703e7bb6af3e0a2c9e27b8) - [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config` [`1a44053`](https://github.com/ljharb/make-arrow-function/commit/1a4405353cddaa09b09bb50e765324c52f9bfd74) - [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` [`7adf890`](https://github.com/ljharb/make-arrow-function/commit/7adf8904711dcf905ff439518d74e92ed3216921) - [Tests] up to `node` `v5.9`, `v4.4` [`bd412a5`](https://github.com/ljharb/make-arrow-function/commit/bd412a518a2658702b2f350a5677b35fa9c50f33) - [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config`, `nsp` [`8a23d6c`](https://github.com/ljharb/make-arrow-function/commit/8a23d6cd2ec57983bd91a1137a88f1fc492d019c) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `nsp` [`69ef6fa`](https://github.com/ljharb/make-arrow-function/commit/69ef6facba89455525dc5182b6b0770e696e773c) - [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`ca199f0`](https://github.com/ljharb/make-arrow-function/commit/ca199f0954042e17a42793af5c818c435e6b1f94) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`; add `safe-publish-latest` [`5907bd2`](https://github.com/ljharb/make-arrow-function/commit/5907bd2848009f4a5213d3c23a8e5acfb6cbdd7d) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `tape` [`2ce975f`](https://github.com/ljharb/make-arrow-function/commit/2ce975f11734167f5f820c7cf5038b32190089cb) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `nsp`, `tape` [`fcb3fb4`](https://github.com/ljharb/make-arrow-function/commit/fcb3fb441f36cf9371e0c4a5c5e35d2c6a8c050f) - Only apps should have lockfiles. [`7cfdd91`](https://github.com/ljharb/make-arrow-function/commit/7cfdd914e838a8342140152b96a202d522b2cd2a) - [Tests] fix npm upgrades for older nodes [`e0a7daa`](https://github.com/ljharb/make-arrow-function/commit/e0a7daa48e0d5c032fabb05b38ea3848a8e414e5) - [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config`, `nsp` [`5fa4159`](https://github.com/ljharb/make-arrow-function/commit/5fa41598ccdc3b43d8f2f357745e88efbe20f76d) - [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`92245fc`](https://github.com/ljharb/make-arrow-function/commit/92245fce01f1e5b51260ea5230ea9d5704237a0f) - [Tests] use `npm audit` instead of `nsp` [`34b329f`](https://github.com/ljharb/make-arrow-function/commit/34b329f1b6e2222995e5002ac1638c818f199ada) - [Tests] up to `node` `v6.2` [`904b5f7`](https://github.com/ljharb/make-arrow-function/commit/904b5f7472fc7e057e9a41fa4722aef6556f001c) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `nsp` [`e34fcc9`](https://github.com/ljharb/make-arrow-function/commit/e34fcc95696e38fda6f3a562967da62a56c398d1) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `nsp` [`064520a`](https://github.com/ljharb/make-arrow-function/commit/064520a26da60b21ebf2d3987e1e3d04e74ade17) - [Dev Deps] update `nsp`, `eslint` [`bec9f88`](https://github.com/ljharb/make-arrow-function/commit/bec9f88db3d050cdd4c011202021d19bd41fb5bb) - [Tests] up to `node` `v7.2` [`5f02294`](https://github.com/ljharb/make-arrow-function/commit/5f02294a3ac41ab207fc5d7ebcf99bd06928c15a) - [Dev Deps] remove unused eccheck script + dep [`00c7167`](https://github.com/ljharb/make-arrow-function/commit/00c716716f9b3dc3d5756a36be663b1a27cbf0f0) - [Tests] use pretest/posttest for linting/security [`3dacf2b`](https://github.com/ljharb/make-arrow-function/commit/3dacf2b1381de803a947d9aa8d6e4f1264369b3d) - [meta] add `funding` field [`c03306f`](https://github.com/ljharb/make-arrow-function/commit/c03306f1e129c0d4be45d9ae752f8bd735c73b57) - `node` supports arrow functions now. [`b593c16`](https://github.com/ljharb/make-arrow-function/commit/b593c160644473bca6861c40bf5e8b500cdba2b7) - [Dev Deps] update `eslint` [`2377184`](https://github.com/ljharb/make-arrow-function/commit/2377184f5ec490115226c9470e0b163c84770d4a) - [Dev Deps] update `eslint` [`cf7208f`](https://github.com/ljharb/make-arrow-function/commit/cf7208f7e6445449ae5d28a8d36d0c18b00213b1) - [Tests] on `node` `v5.12` [`4200680`](https://github.com/ljharb/make-arrow-function/commit/4200680c4e9156e1118826b91f1802385fa903ba) - [Tests] on `node` `v5.10` [`d108b50`](https://github.com/ljharb/make-arrow-function/commit/d108b50f2253e4d455eaa3b54232cd2d0d4d3028) - [Dev Deps] update `@ljharb/eslint-config` [`1276f60`](https://github.com/ljharb/make-arrow-function/commit/1276f6040a0361d71af6c5d2f914a310a23bda37) - [Tests] on `node` `v5.1` [`5f8e775`](https://github.com/ljharb/make-arrow-function/commit/5f8e775b364eda721b2da38a1c249586a780c207) - [Tests] on `node` `v4.2` [`fc0da59`](https://github.com/ljharb/make-arrow-function/commit/fc0da5964613ee840c14de7a5d385ea737ba00e2) - [Tests] on `node` `v5.0` [`c38c355`](https://github.com/ljharb/make-arrow-function/commit/c38c355dcaac1916ebb8eef18efea62ef3c8c070) ## [v1.1.0](https://github.com/ljharb/make-arrow-function/compare/v1.0.0...v1.1.0) - 2015-08-18 ### Commits - Update `eslint`, `tape`; use my personal shared `eslint` config. [`bfe1710`](https://github.com/ljharb/make-arrow-function/commit/bfe17105d67fd3b524b0da4863d4e52a4a62f634) - Add `npm run eslint` [`a03fb9b`](https://github.com/ljharb/make-arrow-function/commit/a03fb9be86916f9792150389a6b138ef7f38544a) - Update `tape`, `covert`, `jscs` [`cec9e4c`](https://github.com/ljharb/make-arrow-function/commit/cec9e4c040082d791363c8eb5789d1fd503c6d00) - Update `eslint` [`6094194`](https://github.com/ljharb/make-arrow-function/commit/60941946adf7093e23d9cec7c52092a6ec2d728d) - Update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`bea60f8`](https://github.com/ljharb/make-arrow-function/commit/bea60f8fc043ea4440aafe71a883905305596463) - All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`. [`4a2dfca`](https://github.com/ljharb/make-arrow-function/commit/4a2dfcaecce6be0e7ff6aa4f2a0b1d78545f79fc) - Test up to `io.js` `v2.2` [`2919253`](https://github.com/ljharb/make-arrow-function/commit/291925367f67847301c06492fbb5c86afb789cd8) - Update `eslint`, `nsp` [`2ca00cb`](https://github.com/ljharb/make-arrow-function/commit/2ca00cb2b166668bd5dd86816e233100c7e7cd2f) - Adding a CHANGELOG [`b9e3baa`](https://github.com/ljharb/make-arrow-function/commit/b9e3baa4153817e5697bdfabb3a6e9320dd3ecfe) - [Dev Deps] update `jscs` [`9f065ad`](https://github.com/ljharb/make-arrow-function/commit/9f065ada33b79edee084c695daaf7c14c79c9b17) - Update `is`, `tape`, `jscs`, `nsp` [`e34e281`](https://github.com/ljharb/make-arrow-function/commit/e34e281ae9eee65f32ce06675bffb2b2dbe0a887) - Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures. [`8e3ca1d`](https://github.com/ljharb/make-arrow-function/commit/8e3ca1da8499e2bbc0a2ee2764a82876465c43db) - Test on latest `io.js` [`2b529be`](https://github.com/ljharb/make-arrow-function/commit/2b529be2b569f27a481823a659be90e0906338f4) - Removing unused devDeps; updating `editorconfig-tools` [`82a4ab0`](https://github.com/ljharb/make-arrow-function/commit/82a4ab00a280ceccbb367c8d95f836c4c49c7bc2) - Add arrow functions with explicit block bodies. [`610403c`](https://github.com/ljharb/make-arrow-function/commit/610403ccff3f35289271152636d3cd755933ddbf) - [Dev Deps] Update `tape`, `eslint` [`84aac4c`](https://github.com/ljharb/make-arrow-function/commit/84aac4c7fdef5ad8069a75b10349d929fd73d7d3) - Test on `iojs-v1.5` and `iojs-v1.6` [`17b0ec9`](https://github.com/ljharb/make-arrow-function/commit/17b0ec9bdaf3fbcfb5f36683f16523d79853547c) - Update `editorconfig-tools`, `nsp` [`e69c479`](https://github.com/ljharb/make-arrow-function/commit/e69c47926b28bcc0884de74ddacd1c1866c0aebe) - Update `jscs` [`ce48723`](https://github.com/ljharb/make-arrow-function/commit/ce487231f32ac162e8c03b06ec0e6f00f5887a64) - Test up to `io.js` `v3.0` [`c230011`](https://github.com/ljharb/make-arrow-function/commit/c2300114bb1df9977fafc377b25735ee721d7cbb) - [Dev Deps] update `tape` [`4035b74`](https://github.com/ljharb/make-arrow-function/commit/4035b74c7dbc8ba0939d7e4c4c37165ab495fe0a) - Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. [`0bbbc0f`](https://github.com/ljharb/make-arrow-function/commit/0bbbc0f2d4e6f15a26d1830a9fb811e95254da87) - Test on `io.js` `v2.4` [`35968fc`](https://github.com/ljharb/make-arrow-function/commit/35968fc31eb60149349b2d23bcb67e2aa030d9a4) - Test on `io.js` `v2.3` [`50b5d68`](https://github.com/ljharb/make-arrow-function/commit/50b5d68f1d326b4811202c9d3aabed4015093dd8) - Test on `iojs-v1.2` [`10c8b49`](https://github.com/ljharb/make-arrow-function/commit/10c8b49bec13b3aa63dc45a622785b0bed8d5749) ## v1.0.0 - 2014-12-15 ### Commits - Dotfiles. [`9ed14fc`](https://github.com/ljharb/make-arrow-function/commit/9ed14fc6c5aca2a35ed9aeda4f2884763b016bc5) - package.json [`64ee706`](https://github.com/ljharb/make-arrow-function/commit/64ee706c432de2388294b7fa711c35b4cbf8e94a) - README. [`c115358`](https://github.com/ljharb/make-arrow-function/commit/c11535838b8111f8007ced147a0285a4951fff29) - Tests [`65f9fee`](https://github.com/ljharb/make-arrow-function/commit/65f9feea655ff07e93f53b2e6ae6f8ad83d7a168) - Implementation [`6deb214`](https://github.com/ljharb/make-arrow-function/commit/6deb214ddf954de5e3621b57846c279892a69411) - Initial commit. [`22ffe6a`](https://github.com/ljharb/make-arrow-function/commit/22ffe6a335d4384d932724ad3826e558cc34e52b) make-arrow-function-1.2.0/LICENSE000066400000000000000000000020711361370106100164050ustar00rootroot00000000000000The 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. make-arrow-function-1.2.0/README.md000066400000000000000000000036511361370106100166640ustar00rootroot00000000000000#make-arrow-function [![Version Badge][npm-version-svg]][package-url] [![Build Status][travis-svg]][travis-url] [![dependency status][deps-svg]][deps-url] [![dev dependency status][dev-deps-svg]][dev-deps-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![npm badge][npm-badge-png]][package-url] [![browser support][testling-svg]][testling-url] Function that returns an arbitrary arrow function, or undefined if arrow function syntax is unsupported. ## Example ```js var maybeArrowFunction = require('make-arrow-function')(); if (maybeArrowFunction) { assert(typeof maybeArrowFunction === 'function'); } else { assert(typeof maybeArrowFunction === 'undefined'); } var arrowFunctions = require('make-arrow-function').list(); assert(arrowFunctions.every(function (fn) { return typeof fn === 'function'; })); ``` ## Tests Simply clone the repo, `npm install`, and run `npm test` [package-url]: https://npmjs.org/package/make-arrow-function [npm-version-svg]: http://versionbadg.es/ljharb/make-arrow-function.svg [travis-svg]: https://travis-ci.org/ljharb/make-arrow-function.svg [travis-url]: https://travis-ci.org/ljharb/make-arrow-function [deps-svg]: https://david-dm.org/ljharb/make-arrow-function.svg [deps-url]: https://david-dm.org/ljharb/make-arrow-function [dev-deps-svg]: https://david-dm.org/ljharb/make-arrow-function/dev-status.svg [dev-deps-url]: https://david-dm.org/ljharb/make-arrow-function#info=devDependencies [testling-svg]: https://ci.testling.com/ljharb/make-arrow-function.png [testling-url]: https://ci.testling.com/ljharb/make-arrow-function [npm-badge-png]: https://nodei.co/npm/make-arrow-function.png?downloads=true&stars=true [license-image]: http://img.shields.io/npm/l/make-arrow-function.svg [license-url]: LICENSE [downloads-image]: http://img.shields.io/npm/dm/make-arrow-function.svg [downloads-url]: http://npm-stat.com/charts.html?package=make-arrow-function make-arrow-function-1.2.0/index.js000066400000000000000000000014601361370106100170460ustar00rootroot00000000000000'use strict'; var getArrows = function getArrowFunctions() { return [ 'return (a, b) => a * b;', 'return () => 42;', 'return () => function () {};', 'return () => x => x * x;', 'return y => x => x * x;', 'return x => x * x;', 'return x => { return x * x; }', 'return (x, y) => { return x + x; }', '"use strict"; return (a = Math.random(10)) => {};', '"use strict"; return (a = function() {\n\tif (Math.random() < 0.5) { return 42; }\n\treturn "something else";\n}) => a();' ]; }; var arrowFuncs = []; var fns = getArrows(); for (var i = 0; i < fns.length; ++i) { try { arrowFuncs.push(Function(fns[i])()); } catch (e) { /**/ } } module.exports = function makeArrowFunction() { return arrowFuncs[0]; }; module.exports.list = function makeArrowFunctions() { return arrowFuncs.slice(); }; make-arrow-function-1.2.0/package.json000066400000000000000000000034271361370106100176740ustar00rootroot00000000000000{ "name": "make-arrow-function", "version": "1.2.0", "author": "Jordan Harband", "funding": { "url": "https://github.com/sponsors/ljharb" }, "description": "Function that returns an arbitrary arrow function, or undefined if arrow function syntax is unsupported.", "license": "MIT", "main": "index.js", "scripts": { "prepublish": "safe-publish-latest", "pretest": "npm run --silent lint", "test": "npm run tests-only", "tests-only": "node test", "posttest": "npx aud", "coverage": "covert test/*.js", "lint": "eslint .", "version": "auto-changelog && git add CHANGELOG.md", "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" }, "repository": { "type": "git", "url": "git://github.com/ljharb/make-arrow-function.git" }, "bugs": { "url": "https://github.com/ljharb/make-arrow-function/issues" }, "keywords": [ "arrow function", "ES6", "arrow", "fat arrow" ], "dependencies": {}, "devDependencies": { "@ljharb/eslint-config": "^16.0.0", "auto-changelog": "^1.16.2", "covert": "^1.1.1", "eslint": "^6.8.0", "safe-publish-latest": "^1.1.4", "tape": "^5.0.0-next.4" }, "testling": { "files": "test/index.js", "browsers": [ "iexplore/6.0..latest", "firefox/3.0..6.0", "firefox/15.0..latest", "firefox/nightly", "chrome/4.0..10.0", "chrome/20.0..latest", "chrome/canary", "opera/10.0..latest", "opera/next", "safari/4.0..latest", "ipad/6.0..latest", "iphone/6.0..latest", "android-browser/4.2" ] }, "engines": { "node": ">= 0.4" }, "auto-changelog": { "output": "CHANGELOG.md", "template": "keepachangelog", "unreleased": false, "commitLimit": false, "backfillLimit": false } } make-arrow-function-1.2.0/test/000077500000000000000000000000001361370106100163575ustar00rootroot00000000000000make-arrow-function-1.2.0/test/index.js000066400000000000000000000025541361370106100200320ustar00rootroot00000000000000'use strict'; var test = require('tape'); var makeArrowFunction = require('../'); test('makeArrowFunction() is undefined or an arrow function', function (t) { var arrowFunction = makeArrowFunction(); if (arrowFunction) { t.equal(typeof arrowFunction, 'function', 'makeArrowFunction is function'); t.equal(String(arrowFunction), '(a, b) => a * b', 'arrowFunction has expected source'); } else { t.equal(typeof arrowFunction, 'undefined', 'makeArrowFunction is undefined'); } t.end(); }); test('makeArrowFunction.list() is an array', function (t) { var funcs = makeArrowFunction.list(); var expectedSources = [ '(a, b) => a * b', '() => 42', '() => function () {}', '() => x => x * x', 'y => x => x * x', 'x => x * x', 'x => { return x * x; }', '(x, y) => { return x + x; }', '(a = Math.random(10)) => {}', '(a = function() {\n\tif (Math.random() < 0.5) { return 42; }\n\treturn "something else";\n}) => a()' ]; t.plan(1 + (2 * funcs.length)); t.equal(Object.prototype.toString.call(funcs), '[object Array]', 'list() is an array'); 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(); });