-
-
Notifications
You must be signed in to change notification settings - Fork 225
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
Conversation
Deploy preview for js-primer ready! Built with commit adf429b |
tag(`template ${0} literal ${1}`); | ||
``` | ||
|
||
しかし、`()`ではなく ``` タグ関数`テンプレート` ``` と記述することで、`タグ関数`が受け取る引数にはタグ付きテンプレート向けの値が渡ってきます。 |
There was a problem hiding this comment.
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]); |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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`コンストラクタの違いとして、正規表現のパターンが評価(コンパイル)されるタイミングの違いがあります。 |
There was a problem hiding this comment.
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
fix #208
fix #785
Ref #813