1.2.4 • Published 6 years ago

objective-c-parser v1.2.4

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

objective-c-parser Build Status Coverage Status BCH compliance

Get an objective-c header file and translate it to equivalent javascript calls

Install

$ npm install objective-c-parser

Usage

const fs = require("fs");
const objectiveCParser = require("objective-c-parser");
const content = fs.readFileSync("/path/to/objective-c/Ponies.h");

const output = objectiveCParser(content);

fs.writeFileSync("/path/to/project/ponies.json", output);

Example

#import <Foundation/Foundation.h>
@protocol Ponies, Foo;
@interface BasicName : NSObject

// Another comment
@property(nonatomic, readonly) uninteresting<IgnorePlease> matcher;


// This is the comment of basic method one
- (NSInteger)basicMethodOne;

/**
 *  This is the comment of basic method two.
 *  It has multiple lines
 */
- (NSString) basicMethodTwoWithArgOne:(NSInteger)argOne AndArgTwo:(NSString)argTwo;
@end
{
	"name": "BasicName",
	"methods": [
		{
			"args": [],
			"comment": "This is the comment of basic method one",
			"name": "basicMethodOne",
			"returnType": "NSInteger"
		},
		{
			"args": [
				{
					"type": "NSInteger",
					"name": "argOne"
				},
				{
					"type": "NSString",
					"name": "argTwo"
				}
			],
			"comment":
				"This is the comment of basic method two.\nIt has multiple lines",
			"name": "basicMethodTwoWithArgOneAndArgTwo",
			"returnType": "NSString"
		}
	]
}

Please be aware that name can be undefined if the headerfile does not contain an @interface declaration.

License

MIT © Daniel Schmidt

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago