aboutsummaryrefslogtreecommitdiff
path: root/node_modules/call-signature
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/call-signature')
-rw-r--r--node_modules/call-signature/index.js83
-rw-r--r--node_modules/call-signature/license21
-rw-r--r--node_modules/call-signature/package.json34
-rw-r--r--node_modules/call-signature/readme.md113
4 files changed, 0 insertions, 251 deletions
diff --git a/node_modules/call-signature/index.js b/node_modules/call-signature/index.js
deleted file mode 100644
index 327cb56ed..000000000
--- a/node_modules/call-signature/index.js
+++ /dev/null
@@ -1,83 +0,0 @@
-'use strict';
-module.exports.parse = parse;
-module.exports.generate = generate;
-
-// TODO(jamestalmage): Allow full range of identifier characters instead of just ASCII
-//
-// This will likely require a build step
-//
-// SPEC: http://www.ecma-international.org/ecma-262/5.1/#sec-7.6
-//
-// TOOLING:
-// https://github.com/mathiasbynens/regenerate
-// https://www.npmjs.com/package/regjsgen
-
-var regex = /^\s*(?:([A-Za-z$_][A-Za-z0-9$_]*)\s*\.)?\s*([A-Za-z$_][A-Za-z0-9$_]*)\s*\(\s*((?:[A-Za-z$_][A-Za-z0-9$_]*)|(?:\[\s*[A-Za-z$_][A-Za-z0-9$_]*\s*]))?((?:\s*,\s*(?:(?:[A-Za-z$_][A-Za-z0-9$_]*)|(?:\[\s*[A-Za-z$_][A-Za-z0-9$_]*\s*])))+)?\s*\)\s*$/;
-
-function parse(str) {
- var match = regex.exec(str);
- if (!match) {
- return null;
- }
-
- var callee;
- if (match[1]) {
- callee = {
- type: 'MemberExpression',
- object: match[1],
- member: match[2]
- };
- } else {
- callee = {
- type: 'Identifier',
- name: match[2]
- };
- }
-
- var args = match[4] || '';
- args = args.split(',');
- if (match[3]) {
- args[0] = match[3];
- }
- var trimmed = [];
- args.forEach(function (str) {
- var optional = false;
- str = str.replace(/\s+/g, '');
- if (!str.length) {
- return;
- }
- if (str.charAt(0) === '[' && str.charAt(str.length - 1) === ']') {
- optional = true;
- str = str.substring(1, str.length - 1);
- }
- trimmed.push({
- name: str,
- optional: optional
- });
- });
-
- return {
- callee: callee,
- args: trimmed
- };
-}
-
-function generate(parsed) {
- var callee;
- if (parsed.callee.type === 'MemberExpression') {
- callee = [
- parsed.callee.object,
- '.',
- parsed.callee.member
- ];
- } else {
- callee = [parsed.callee.name];
- }
- return callee.concat([
- '(',
- parsed.args.map(function (arg) {
- return arg.optional ? '[' + arg.name + ']' : arg.name;
- }).join(', '),
- ')'
- ]).join('');
-}
diff --git a/node_modules/call-signature/license b/node_modules/call-signature/license
deleted file mode 100644
index ad5d021ed..000000000
--- a/node_modules/call-signature/license
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) James Talmage <james@talmage.io> (github.com/jamestalmage)
-
-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/node_modules/call-signature/package.json b/node_modules/call-signature/package.json
deleted file mode 100644
index ef3aec3c5..000000000
--- a/node_modules/call-signature/package.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "name": "call-signature",
- "version": "0.0.2",
- "description": "Parse / Generate Method Signatures",
- "license": "MIT",
- "repository": "jamestalmage/call-signature",
- "author": {
- "name": "James Talmage",
- "email": "james@talmage.io",
- "url": "github.com/jamestalmage"
- },
- "engines": {
- "node": ">=0.10.0"
- },
- "scripts": {
- "test": "xo && ava"
- },
- "files": [
- "index.js"
- ],
- "keywords": [
- ""
- ],
- "dependencies": {},
- "devDependencies": {
- "ava": "^0.5.0",
- "xo": "^0.11.2"
- },
- "xo": {
- "ignores": [
- "test.js"
- ]
- }
-}
diff --git a/node_modules/call-signature/readme.md b/node_modules/call-signature/readme.md
deleted file mode 100644
index 0ea355e03..000000000
--- a/node_modules/call-signature/readme.md
+++ /dev/null
@@ -1,113 +0,0 @@
-# call-signature [![Build Status](https://travis-ci.org/jamestalmage/call-signature.svg?branch=master)](https://travis-ci.org/jamestalmage/call-signature)
-
-> Parse / Generate Method Signatures
-
-
-## Install
-
-```
-$ npm install --save call-signature
-```
-
-
-## Usage
-
-```js
-var signature = require('call-signature');
-
-// parse a call signature definition
-var parsed = signature.parse('t.equal(expected, actual, [message])');
-
-console.log(parsed);
-/* =>
- {
- callee: {
- type: 'MemberExpression',
- object: 't',
- member: 'equal'
- },
- args: [
- {
- name: 'actual',
- optional: false
- },
- {
- name: 'expected',
- optional: false
- },
- {
- name: 'message',
- optional: true
- }
- ]
- }
-*/
-
-
-// Create signature definitions from the parsed object.
-signature.generate(parsed);
-
-//=> "t.equal(expected, actual, [message])"
-```
-
-
-## API
-
-### callSignature.parse(input)
-
-#### input
-
-Type: `string`
-
-A string that matches the call signature spec:
-
-`object.member(required_arg1, required_arg2, [optional_arg1])`
-`name(required_arg1, required_arg2, [optional_arg1])`
-
-`object`, `member` and `name` can be any identifiers, but currently the callee must be a `MemberExpression` or an `Identifier` (that requirement may loosen in the future).
-
-You can have any number of arguments. Optional arguments are denoted by placing the argument name between square `[`brackets`]`.
-
-#### returns
-
-A simple JS Object with three properties `callee` and `args`.
-
-`callee` will be an object containing `type` property and its corresponding properties.
-
-when matched against `MemberExpression` like `foo.bar(baz)`, `object` and `member` will be strings.
-
- callee: {
- type: 'MemberExpression',
- object: 'foo',
- member: 'bar'
- }
-
-when matched against `Identifier` like `foo(baz)`, `name` will be string.
-
- callee: {
- type: 'Identifier',
- name: 'foo'
- }
-
-`args` will be an array. Each item of the array will have two properties `name`, and `optional`.
- `name` will be the `string` name of the arg. `optional` will be a boolean value.
-
-### callSignature.generate(parsed)
-
-#### input
-
-Type: `Object`
-
-Must have the same definition as the return value from the `parse` method.
-
-#### returns
-
-A `string` signature definition that will parse to exactly the provided input.
-
-## Related
-
-- [escallmatch](https://www.npmjs.com/package/escallmatch) - Similar, with compatible string definitions to this library. Can be used to match AST Nodes to parsed signatures.
-
-## License
-
-MIT © [James Talmage](http://github.com/jamestalmage)