Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(string): 文字列のリファクタリング #858

Merged
merged 58 commits into from
Jul 23, 2019

Conversation

azu
Copy link
Collaborator

@azu azu commented Jun 30, 2019

fix #208
fix #785
Ref #813

@bot-user
Copy link

bot-user commented Jun 30, 2019

Deploy preview for js-primer ready!

Built with commit adf429b

https://deploy-preview-858--js-primer.netlify.com

@azu azu mentioned this pull request Jun 30, 2019
tag(`template ${0} literal ${1}`);
```

しかし、`()`ではなく ``` タグ関数`テンプレート` ``` と記述することで、`タグ関数`が受け取る引数にはタグ付きテンプレート向けの値が渡ってきます。
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://qiita.com/natecotus/items/be28e1c7111270d9207d この辺。
タグ関数とはって説明する前にタグ関数というワード使ってるのが良くなかった。

return strings.reduce((result, str, i) => {
console.log([result, values[i - 1], str]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reduceの挙動を説明するようのログを入れた


[文字列とUnicode]: ../string-unicode/README.md
[エスケープシーケンス]: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/String#%E3%82%A8%E3%82%B9%E3%82%B1%E3%83%BC%E3%83%97%E3%82%B7%E3%83%BC%E3%82%B1%E3%83%B3%E3%82%B9
[twitter-text]: https://github.com/twitter/twitter-text "twitter/twitter-text: Twitter Text Libraries"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使われてないリンクを削除


<!-- 評価とコンパイルは仕様から来てる用語 https://tc39.es/ecma262/#sec-pattern -->

正規表現リテラルと`RegExp`コンストラクタの違いとして、正規表現のパターンが評価(コンパイル)されるタイミングの違いがあります。
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

評価とコンパイルは仕様から来てる用語 https://tc39.es/ecma262/#sec-pattern

@azu azu merged commit 3035104 into master Jul 23, 2019
@azu azu deleted the 2019-refactor-string branch July 23, 2019 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RegExp#matchの返り値について string: 「文字列」「部分文字列」「検索文字列」
3 participants