basarat / basarat/typescript-book

TIP Strongly typed names

Open
#33 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
21.6k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

getName : https://github.com/TypeStrong/atom-typescript/blob/master/lib/main/lang/utils.ts#L300-L308

```
var nameExtractorRegex = /return (.*);/;
/** Get the name using a lambda so that you don't have magic strings */
export function getName(nameLambda: () => any) {
var m = nameExtractorRegex.exec(nameLambda + "");
if (m == null)
throw new Error("The function does not contain a statement matching 'return variableName;'");
var access = m[1].split('.');
return access[access.length - 1];
}
```

David's function : http://stackoverflow.com/a/32542368/390330

```
function getPropertyName(propertyFunction) {
return /\.([^\.;]+);?\s*\}$/.exec(propertyFunction.toString())[1];
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the linked lib/main/lang/utils.ts implementation and the alternative Stack Overflow function. Then inspect the TypeScript book content to determine where this proposal belongs and what behavior or guidance is expected. The issue does not define a target file or acceptance criteria, so completion cannot be established from the payload alone.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.