@ohos-ports/nbind 0.0.0-stage → 0.3.15-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/.editorconfig +7 -0
  2. package/LICENSE +22 -0
  3. package/README.md +1393 -2
  4. package/autogypi.json +11 -0
  5. package/bin/ci-trigger +40 -0
  6. package/bin/copyasm.js +77 -0
  7. package/bin/emcc +21 -0
  8. package/bin/emcc-path.js +7 -0
  9. package/bin/ndts.js +22 -0
  10. package/config.js +7 -0
  11. package/dist/Type.d.ts +92 -0
  12. package/dist/Type.js +180 -0
  13. package/dist/common.d.ts +9 -0
  14. package/dist/common.js +10 -0
  15. package/dist/em-api.js +2353 -0
  16. package/dist/int64.d.ts +9 -0
  17. package/dist/int64.js +64 -0
  18. package/dist/nbind.d.ts +49 -0
  19. package/dist/nbind.js +154 -0
  20. package/dist/reflect.d.ts +69 -0
  21. package/dist/reflect.js +261 -0
  22. package/dist/shim.d.ts +1 -0
  23. package/dist/shim.js +2 -0
  24. package/dist/todts.d.ts +5 -0
  25. package/dist/todts.js +146 -0
  26. package/include/nbind/ArgStorage.h +67 -0
  27. package/include/nbind/BindClass.h +290 -0
  28. package/include/nbind/BindDefiner.h +295 -0
  29. package/include/nbind/Buffer.h +50 -0
  30. package/include/nbind/FunctionDefiner.h +51 -0
  31. package/include/nbind/MethodDef.h +50 -0
  32. package/include/nbind/Policy.h +255 -0
  33. package/include/nbind/TypeID.h +84 -0
  34. package/include/nbind/TypeStd.h +66 -0
  35. package/include/nbind/TypeTransformer.h +38 -0
  36. package/include/nbind/api.h +100 -0
  37. package/include/nbind/common.h +22 -0
  38. package/include/nbind/em/ArgFromWire.h +31 -0
  39. package/include/nbind/em/BindingStd.h +221 -0
  40. package/include/nbind/em/BindingType.h +204 -0
  41. package/include/nbind/em/Buffer.h +37 -0
  42. package/include/nbind/em/Callback.h +186 -0
  43. package/include/nbind/em/Caller.h +61 -0
  44. package/include/nbind/em/Creator.h +30 -0
  45. package/include/nbind/em/External.h +63 -0
  46. package/include/nbind/em/Int64.h +131 -0
  47. package/include/nbind/em/NBind.h +63 -0
  48. package/include/nbind/em/Pool.h +34 -0
  49. package/include/nbind/em/StdFunction.h +40 -0
  50. package/include/nbind/em/ValueObj.h +54 -0
  51. package/include/nbind/nbind.h +19 -0
  52. package/include/nbind/noconflict.h +91 -0
  53. package/include/nbind/signature/BaseSignature.h +238 -0
  54. package/include/nbind/signature/CallbackSignature.h +59 -0
  55. package/include/nbind/signature/ConstructorSignature.h +76 -0
  56. package/include/nbind/signature/FunctionSignature.h +63 -0
  57. package/include/nbind/signature/GetterSignature.h +62 -0
  58. package/include/nbind/signature/MethodSignature.h +61 -0
  59. package/include/nbind/signature/SetterSignature.h +63 -0
  60. package/include/nbind/signature/SignatureParam.h +39 -0
  61. package/include/nbind/v8/ArgFromWire.h +69 -0
  62. package/include/nbind/v8/BindWrapper.h +295 -0
  63. package/include/nbind/v8/BindingStd.h +180 -0
  64. package/include/nbind/v8/BindingType.h +241 -0
  65. package/include/nbind/v8/Buffer.h +59 -0
  66. package/include/nbind/v8/Callback.h +165 -0
  67. package/include/nbind/v8/Caller.h +140 -0
  68. package/include/nbind/v8/Convert.h +80 -0
  69. package/include/nbind/v8/Creator.h +26 -0
  70. package/include/nbind/v8/External.h +119 -0
  71. package/include/nbind/v8/Int64.h +195 -0
  72. package/include/nbind/v8/NBind.h +63 -0
  73. package/include/nbind/v8/Output.h +36 -0
  74. package/include/nbind/v8/Overloader.h +215 -0
  75. package/include/nbind/v8/StdFunction.h +44 -0
  76. package/include/nbind/v8/ValueObj.h +137 -0
  77. package/include/nbind/wire.h +79 -0
  78. package/package.json +69 -4
  79. package/src/checkver.js +31 -0
  80. package/src/common.cc +129 -0
  81. package/src/em/Binding.cc +313 -0
  82. package/src/em/tsconfig.json +22 -0
  83. package/src/nbind-common.gypi +14 -0
  84. package/src/nbind.gypi +98 -0
  85. package/src/post.js +2 -0
  86. package/src/pre.js +48 -0
  87. package/src/reflect.cc +170 -0
  88. package/src/symbols.txt +1 -0
  89. package/src/tsconfig.json +23 -0
  90. package/src/tslint.json +86 -0
  91. package/src/v8/Binding.cc +391 -0
  92. package/src/v8/Buffer.cc +73 -0
package/autogypi.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "dependencies": [
3
+ "nan"
4
+ ],
5
+ "includes": [
6
+ "src/nbind.gypi"
7
+ ],
8
+ "topIncludes": [
9
+ "src/nbind-common.gypi"
10
+ ]
11
+ }
package/bin/ci-trigger ADDED
@@ -0,0 +1,40 @@
1
+ #!/bin/sh
2
+
3
+ # Clone this repo inside a separate emscripten-travis-binary project
4
+ # and run Emscripten tests there.
5
+
6
+ body='{ "request": {
7
+ "message": "Automatic rebuild",
8
+ "branch": "'$TRAVIS_BRANCH'",
9
+ "config": {
10
+ "node_js": [ "6.0" ],
11
+ "install": [
12
+ "git clone --depth 1 https://github.com/charto/emscripten-travis-binary.git emscripten",
13
+ "emscripten/emsdk activate --build=Release sdk-master-64bit",
14
+ "source emscripten/emsdk_env.sh",
15
+ "git clone --depth=1 --branch='$TRAVIS_BRANCH' https://github.com/'$TRAVIS_REPO_SLUG'.git tree",
16
+ "cd tree",
17
+ "npm install -g npm@4.6.1",
18
+ "npm install"
19
+ ],
20
+ "script": "npm run test-asm",
21
+ "addons": {
22
+ "apt": {
23
+ "sources": [
24
+ "ubuntu-toolchain-r-test"
25
+ ],
26
+ "packages": [
27
+ "libstdc++-4.8-dev"
28
+ ]
29
+ }
30
+ }
31
+ }
32
+ }}'
33
+
34
+ curl -s -X POST \
35
+ -H "Content-Type: application/json" \
36
+ -H "Accept: application/json" \
37
+ -H "Travis-API-Version: 3" \
38
+ -H "Authorization: token $TRAVIS_TOKEN" \
39
+ -d "$body" \
40
+ https://api.travis-ci.org/repo/charto%2Fnbind-ci-emscripten/requests
package/bin/copyasm.js ADDED
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env node
2
+
3
+ var fs = require('fs');
4
+ var path = require('path');
5
+ var mkdirp = require('mkdirp');
6
+
7
+ var nbind = require('../dist/nbind.js');
8
+
9
+ function printUsage() {
10
+ console.log([
11
+ '',
12
+ ' Usage: ' + path.basename(process.argv[1], '.js') + ' [source] target',
13
+ '',
14
+ ' Copy compiled asm.js binaries to desired location',
15
+ '',
16
+ ' source Path to directory containing binding.gyp',
17
+ ' (node-gyp directs compiler output inside).',
18
+ ' Default is current working directory.',
19
+ '',
20
+ ' target Path to an existing directory to copy',
21
+ ' .js and .js.mem files into.',
22
+ ''
23
+ ].join('\n'));
24
+ }
25
+
26
+ var cwd = process.cwd();
27
+ var sourcePath, targetPath;
28
+
29
+ switch(process.argv.length) {
30
+ default:
31
+ printUsage();
32
+ process.exit(1);
33
+
34
+ case 3:
35
+ sourcePath = cwd;
36
+ targetPath = path.resolve(cwd, process.argv[2]);
37
+ break;
38
+
39
+ case 4:
40
+ sourcePath = path.resolve(cwd, process.argv[2]);
41
+ targetPath = path.resolve(cwd, process.argv[3]);
42
+ break;
43
+ }
44
+
45
+ var binaryPath = nbind.find(sourcePath).path;
46
+ var memPath = binaryPath + '.mem';
47
+
48
+ var pathList = [ binaryPath ];
49
+
50
+ try {
51
+ fs.statSync(memPath);
52
+ pathList.push(memPath);
53
+ } catch(err) {}
54
+
55
+ console.log([
56
+ '',
57
+ 'Copying:',
58
+ pathList.map(function(absolutePath) {
59
+ return(' ' + path.relative(cwd, absolutePath));
60
+ }).join('\n'),
61
+ 'to:',
62
+ ' ' + targetPath,
63
+ ''
64
+ ].join('\n'));
65
+
66
+ mkdirp(targetPath, function(err) {
67
+ if(err) {
68
+ console.error(err);
69
+ return;
70
+ }
71
+
72
+ pathList.forEach(function(srcPath) {
73
+ var dstPath = path.join(targetPath, path.basename(srcPath));
74
+
75
+ fs.createReadStream(srcPath).pipe(fs.createWriteStream(dstPath));
76
+ });
77
+ })
package/bin/emcc ADDED
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+
3
+ # This script calls emcc (the Emscripten C++ compiler) with given command line
4
+ # arguments. It removes the "-arch" flag and its parameter, which node-gyp
5
+ # will add on OS X hosts causing a compiler error.
6
+
7
+ skip=0
8
+
9
+ for arg; do
10
+ shift
11
+ [ "$skip" = "1" ] && skip=0 && continue
12
+ case "$arg" in
13
+ -arch) skip=1 ;;
14
+ -mmacosx-version-min=*) ;;
15
+ -fno-tree-sink) ;;
16
+ -fno-tree-vrp) ;;
17
+ *) set -- "$@" "$arg" ;;
18
+ esac
19
+ done
20
+
21
+ emcc $@
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+
3
+ // This script prints out the absolute path to the emcc wrapper script in
4
+ // this directory. node-gyp make_global_settings CXX and LINK require
5
+ // absolute paths to the compiler.
6
+
7
+ process.stdout.write(require('path').resolve(__dirname, 'emcc'));
package/bin/ndts.js ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+
3
+ var path = require('path');
4
+ var nbind = require(path.resolve(__dirname, '..'));
5
+
6
+ var shim = true;
7
+ var target = process.argv[2];
8
+
9
+ if(target == '--no-shim') {
10
+ shim = false;
11
+ target = process.argv[3];
12
+ } else if(process.argv[3] == '--no-shim') {
13
+ shim = false;
14
+ }
15
+
16
+ var binding = nbind.init(path.resolve(process.cwd(), target || '.'));
17
+ var reflect = new (require(path.resolve(__dirname, '../dist/reflect.js')).Reflect)(binding);
18
+
19
+ process.stdout.write(require(path.resolve(__dirname, '../dist/todts.js')).dump({
20
+ reflect: reflect,
21
+ shim: shim
22
+ }));
package/config.js ADDED
@@ -0,0 +1,7 @@
1
+ // This is a SystemJS configuration file for cbuild, to bundle source files
2
+ // together into a self-contained Emscripten library.
3
+
4
+ System.config({
5
+ defaultJSExtensions: true,
6
+ transpiler: false
7
+ });
package/dist/Type.d.ts ADDED
@@ -0,0 +1,92 @@
1
+ export declare const Type: new (spec: TypeSpec) => TypeClass, makeType: <BindType extends TypeClass>(constructType: (kind: TypeFlags, spec: TypeSpecWithName) => BindType, spec: TypeSpec) => BindType, structureList: [TypeFlags, number, string][];
2
+ export declare type PolicyTbl = {
3
+ [name: string]: boolean;
4
+ };
5
+ export interface TypeSpec {
6
+ [key: string]: any;
7
+ id: number;
8
+ name?: string;
9
+ flags: TypeFlags;
10
+ ptrSize?: number;
11
+ paramList?: (TypeClass | number)[];
12
+ }
13
+ export interface TypeSpecWithName extends TypeSpec {
14
+ name: string;
15
+ }
16
+ export interface TypeSpecWithParam extends TypeSpecWithName {
17
+ paramList: (TypeClass | number)[];
18
+ }
19
+ export interface TypeSpecWithSize extends TypeSpecWithName {
20
+ ptrSize: number;
21
+ }
22
+ export interface TypeClass extends TypeSpec {
23
+ toString?(): string;
24
+ makeWireRead?(expr: string, convertParamList?: any[], num?: number): string;
25
+ makeWireWrite?(expr: string, policyTbl: PolicyTbl | null, convertParamList?: any[], num?: number): boolean | string | ((arg: any) => number | boolean);
26
+ wireRead?: (arg: number) => any;
27
+ wireWrite?: (arg: any) => number;
28
+ spec: TypeSpec;
29
+ name: string;
30
+ }
31
+ export declare const enum TypeFlagBase {
32
+ flag = 1,
33
+ num = 8,
34
+ ref = 128,
35
+ kind = 1024,
36
+ }
37
+ export declare const enum TypeFlags {
38
+ none = 0,
39
+ flagMask = 3,
40
+ isConst = 1,
41
+ isValueObject = 2,
42
+ isMethod = 4,
43
+ numMask = 120,
44
+ isUnsigned = 8,
45
+ isSignless = 16,
46
+ isFloat = 32,
47
+ isBig = 64,
48
+ refMask = 896,
49
+ isPointer = 128,
50
+ isReference = 256,
51
+ isRvalueRef = 384,
52
+ isSharedPtr = 512,
53
+ isUniquePtr = 640,
54
+ kindMask = 15360,
55
+ isArithmetic = 1024,
56
+ isClass = 2048,
57
+ isClassPtr = 3072,
58
+ isSharedClassPtr = 4096,
59
+ isVector = 5120,
60
+ isArray = 6144,
61
+ isCString = 7168,
62
+ isString = 8192,
63
+ isCallback = 9216,
64
+ isOther = 10240,
65
+ }
66
+ export declare const enum StateFlags {
67
+ none = 0,
68
+ isPersistent = 1,
69
+ isDeleted = 2,
70
+ }
71
+ export declare const enum StructureType {
72
+ none = 0,
73
+ constant = 1,
74
+ pointer = 2,
75
+ reference = 3,
76
+ rvalue = 4,
77
+ shared = 5,
78
+ unique = 6,
79
+ vector = 7,
80
+ array = 8,
81
+ callback = 9,
82
+ max = 10,
83
+ }
84
+ export declare function typeModule(self: any): {
85
+ Type: new (spec: TypeSpec) => TypeClass;
86
+ getComplexType: <BindType extends TypeClass>(id: number, constructType: (kind: TypeFlags, spec: TypeSpecWithName) => BindType, getType: (id: number) => BindType, queryType: (id: number) => {
87
+ placeholderFlag: number;
88
+ paramList: (number | number[])[];
89
+ }, place?: string | undefined, kind?: string, prevStructure?: [TypeFlags, number, string] | undefined, depth?: number) => BindType;
90
+ makeType: <BindType extends TypeClass>(constructType: (kind: TypeFlags, spec: TypeSpecWithName) => BindType, spec: TypeSpec) => BindType;
91
+ structureList: [TypeFlags, number, string][];
92
+ };
package/dist/Type.js ADDED
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ // This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
3
+ // Released under the MIT license, see LICENSE.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.Type = (_a = typeModule(typeModule), _a.Type), exports.makeType = _a.makeType, exports.structureList = _a.structureList;
6
+ /* tslint:disable:no-shadowed-variable */
7
+ function typeModule(self) {
8
+ // Parameter count and printable name of each StructureType.
9
+ var structureList = [
10
+ [0, 1, 'X'],
11
+ [1 /* isConst */, 1, 'const X'],
12
+ [128 /* isPointer */, 1, 'X *'],
13
+ [256 /* isReference */, 1, 'X &'],
14
+ [384 /* isRvalueRef */, 1, 'X &&'],
15
+ [512 /* isSharedPtr */, 1, 'std::shared_ptr<X>'],
16
+ [640 /* isUniquePtr */, 1, 'std::unique_ptr<X>'],
17
+ [5120 /* isVector */, 1, 'std::vector<X>'],
18
+ [6144 /* isArray */, 2, 'std::array<X, Y>'],
19
+ [9216 /* isCallback */, -1, 'std::function<X (Y)>']
20
+ ];
21
+ function applyStructure(outerName, outerFlags, innerName, innerFlags, param, flip) {
22
+ if (outerFlags == 1 /* isConst */) {
23
+ var ref = innerFlags & 896 /* refMask */;
24
+ if (ref == 128 /* isPointer */ ||
25
+ ref == 256 /* isReference */ ||
26
+ ref == 384 /* isRvalueRef */)
27
+ outerName = 'X const';
28
+ }
29
+ var name;
30
+ if (flip) {
31
+ name = innerName.replace('X', outerName).replace('Y', param);
32
+ }
33
+ else {
34
+ name = outerName.replace('X', innerName).replace('Y', param);
35
+ }
36
+ // Remove spaces between consecutive * and & characters.
37
+ return (name.replace(/([*&]) (?=[*&])/g, '$1'));
38
+ }
39
+ function reportProblem(problem, id, kind, structureType, place) {
40
+ throw (new Error(problem + ' type ' +
41
+ kind.replace('X', id + '?') +
42
+ (structureType ? ' with flag ' + structureType : '') +
43
+ ' in ' + place));
44
+ }
45
+ function getComplexType(id, constructType, getType, queryType, place,
46
+ // C++ type name string built top-down, for printing helpful errors.
47
+ kind, // tslint:disable-line
48
+ // Outer type, used only for updating kind.
49
+ prevStructure, // tslint:disable-line
50
+ depth // tslint:disable-line
51
+ ) {
52
+ // C++ type name string built top-down, for printing helpful errors.
53
+ if (kind === void 0) { kind = 'X'; }
54
+ if (depth === void 0) { depth = 1; } // tslint:disable-line
55
+ var result = getType(id);
56
+ if (result)
57
+ return (result);
58
+ var query = queryType(id);
59
+ var structureType = query.placeholderFlag;
60
+ var structure = structureList[structureType];
61
+ if (prevStructure && structure) {
62
+ kind = applyStructure(prevStructure[2], prevStructure[0], kind, structure[0], '?', true);
63
+ }
64
+ var problem;
65
+ if (structureType == 0)
66
+ problem = 'Unbound';
67
+ if (structureType >= 10 /* max */)
68
+ problem = 'Corrupt';
69
+ if (depth > 20)
70
+ problem = 'Deeply nested';
71
+ if (problem)
72
+ reportProblem(problem, id, kind, structureType, place || '?');
73
+ var subId = query.paramList[0];
74
+ var subType = getComplexType(subId, constructType, getType, queryType, place, kind, structure, depth + 1);
75
+ var srcSpec;
76
+ var spec = {
77
+ flags: structure[0],
78
+ id: id,
79
+ name: '',
80
+ paramList: [subType]
81
+ };
82
+ var argList = [];
83
+ var structureParam = '?';
84
+ switch (query.placeholderFlag) {
85
+ case 1 /* constant */:
86
+ srcSpec = subType.spec;
87
+ break;
88
+ case 2 /* pointer */:
89
+ if ((subType.flags & 15360 /* kindMask */) == 1024 /* isArithmetic */ &&
90
+ subType.spec.ptrSize == 1) {
91
+ spec.flags = 7168 /* isCString */;
92
+ break;
93
+ }
94
+ // tslint:disable-next-line:no-switch-case-fall-through
95
+ case 3 /* reference */:
96
+ // tslint:disable-next-line:no-switch-case-fall-through
97
+ case 6 /* unique */:
98
+ // tslint:disable-next-line:no-switch-case-fall-through
99
+ case 5 /* shared */:
100
+ srcSpec = subType.spec;
101
+ if ((subType.flags & 15360 /* kindMask */) != 2048 /* isClass */) {
102
+ // reportProblem('Unsupported', id, kind, structureType, place);
103
+ }
104
+ break;
105
+ case 8 /* array */:
106
+ structureParam = '' + query.paramList[1];
107
+ spec.paramList.push(query.paramList[1]);
108
+ break;
109
+ case 9 /* callback */:
110
+ for (var _i = 0, _a = query.paramList[1]; _i < _a.length; _i++) {
111
+ var paramId = _a[_i];
112
+ var paramType = getComplexType(paramId, constructType, getType, queryType, place, kind, structure, depth + 1);
113
+ argList.push(paramType.name);
114
+ spec.paramList.push(paramType);
115
+ }
116
+ structureParam = argList.join(', ');
117
+ break;
118
+ default:
119
+ break;
120
+ }
121
+ spec.name = applyStructure(structure[2], structure[0], subType.name, subType.flags, structureParam);
122
+ if (srcSpec) {
123
+ for (var _b = 0, _c = Object.keys(srcSpec); _b < _c.length; _b++) {
124
+ var key = _c[_b];
125
+ spec[key] = spec[key] || srcSpec[key];
126
+ }
127
+ spec.flags |= srcSpec.flags;
128
+ }
129
+ return (makeType(constructType, spec));
130
+ }
131
+ function makeType(constructType, spec) {
132
+ var flags = spec.flags;
133
+ var refKind = flags & 896 /* refMask */;
134
+ var kind = flags & 15360 /* kindMask */;
135
+ if (!spec.name && kind == 1024 /* isArithmetic */) {
136
+ if (spec.ptrSize == 1) {
137
+ spec.name = (flags & 16 /* isSignless */ ?
138
+ '' :
139
+ (flags & 8 /* isUnsigned */ ? 'un' : '') + 'signed ') + 'char';
140
+ }
141
+ else {
142
+ spec.name = ((flags & 8 /* isUnsigned */ ? 'u' : '') +
143
+ (flags & 32 /* isFloat */ ? 'float' : 'int') +
144
+ (spec.ptrSize * 8 + '_t'));
145
+ }
146
+ }
147
+ if (spec.ptrSize == 8 && !(flags & 32 /* isFloat */))
148
+ kind = 64 /* isBig */;
149
+ if (kind == 2048 /* isClass */) {
150
+ if (refKind == 512 /* isSharedPtr */ || refKind == 640 /* isUniquePtr */) {
151
+ kind = 4096 /* isSharedClassPtr */;
152
+ }
153
+ else if (refKind)
154
+ kind = 3072 /* isClassPtr */;
155
+ }
156
+ return (constructType(kind, spec));
157
+ }
158
+ var Type = (function () {
159
+ function Type(spec) {
160
+ this.id = spec.id;
161
+ this.name = spec.name;
162
+ this.flags = spec.flags;
163
+ this.spec = spec;
164
+ }
165
+ Type.prototype.toString = function () {
166
+ return (this.name);
167
+ };
168
+ return Type;
169
+ }());
170
+ var output = {
171
+ Type: Type,
172
+ getComplexType: getComplexType,
173
+ makeType: makeType,
174
+ structureList: structureList
175
+ };
176
+ self.output = output;
177
+ return (self.output || output);
178
+ }
179
+ exports.typeModule = typeModule;
180
+ var _a;
@@ -0,0 +1,9 @@
1
+ export declare const enum SignatureType {
2
+ none = 0,
3
+ func = 1,
4
+ method = 2,
5
+ getter = 3,
6
+ setter = 4,
7
+ construct = 5,
8
+ }
9
+ export declare function removeAccessorPrefix(name: string): string;
package/dist/common.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
3
+ // Released under the MIT license, see LICENSE.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ function removeAccessorPrefix(name) {
6
+ // The C++ side gives the same name to getters and setters.
7
+ var prefixMatcher = /^[Gg]et_?([A-Z]?([A-Z]?))/;
8
+ return (name.replace(prefixMatcher, function (match, initial, second) { return (second ? initial : initial.toLowerCase()); }));
9
+ }
10
+ exports.removeAccessorPrefix = removeAccessorPrefix;