{"id":5308,"date":"2023-01-05T12:25:37","date_gmt":"2023-01-05T04:25:37","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=5308"},"modified":"2023-01-05T12:25:37","modified_gmt":"2023-01-05T04:25:37","slug":"1-%e4%ba%86%e8%a7%a3typescript%e4%b8%ad%e7%9a%84issnakecase%e5%ad%97%e4%b8%b2%e6%b1%82%e5%80%bc%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/typescript\/1-%e4%ba%86%e8%a7%a3typescript%e4%b8%ad%e7%9a%84issnakecase%e5%ad%97%e4%b8%b2%e6%b1%82%e5%80%bc%e5%8a%9f%e8%83%bd\/","title":{"rendered":"1.\u4e86\u89e3TypeScript\u4e2d\u7684isSnakeCase\u5b57\u4e32\u6c42\u503c\u529f\u80fd"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"TypeScript, \u4e0b\u5283\u7dda\u5b57\u7b26\u4e32, isSnakeCase\"><\/p>\n<h1>TypeScript \u5b57\u4e32\u7684\u6c42\u662f\u5426\u70ba\u4e0b\u5283\u7dda\u5b57\u7b26\u4e32(isSnakeCase)<\/h1>\n<p>TypeScript \u662f\u4e00\u7a2e\u7531 Microsoft \u958b\u767c\u7684 JavaScript \u7684\u8d85\u96c6\uff0c\u5b83\u63d0\u4f9b\u4e86\u5f37\u5927\u7684\u975c\u614b\u985e\u578b\u6aa2\u67e5\u529f\u80fd\uff0c\u53ef\u4ee5\u66f4\u597d\u5730\u63a7\u5236\u7a0b\u5f0f\u78bc\u7684\u54c1\u8cea\u3002\u5728 TypeScript \u4e2d\uff0c\u6709\u4e00\u500b\u51fd\u6578\u53ef\u4ee5\u7528\u4f86\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u70ba\u4e0b\u5283\u7dda\u5b57\u7b26\u4e32\uff0c\u5373 isSnakeCase\u3002<\/p>\n<p>isSnakeCase \u51fd\u6578\u7684\u529f\u80fd\u662f\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u70ba\u4e0b\u5283\u7dda\u5b57\u7b26\u4e32\uff0c\u4e5f\u5c31\u662f\u6240\u6709\u5b57\u6bcd\u90fd\u662f\u5c0f\u5beb\uff0c\u4e26\u4e14\u7528\u4e0b\u5283\u7dda\u5206\u9694\u3002\u4f8b\u5982\uff0c&#8221;hello_world&#8221; \u662f\u4e00\u500b\u4e0b\u5283\u7dda\u5b57\u7b26\u4e32\uff0c\u800c &#8220;HelloWorld&#8221; \u5247\u4e0d\u662f\u3002<\/p>\n<p>isSnakeCase \u51fd\u6578\u7684\u4f7f\u7528\u65b9\u6cd5\u975e\u5e38\u7c21\u55ae\uff0c\u53ea\u9700\u8981\u50b3\u5165\u4e00\u500b\u5b57\u4e32\u53c3\u6578\uff0c\u51fd\u6578\u6703\u8fd4\u56de\u4e00\u500b\u5e03\u6797\u503c\uff0c\u8868\u793a\u8a72\u5b57\u4e32\u662f\u5426\u70ba\u4e0b\u5283\u7dda\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff1a<\/p>\n<pre class=\"brush: typescript\">\nlet isSnakeCase = isSnakeCase(\"hello_world\");\nconsole.log(isSnakeCase); \/\/ true\n<\/pre>\n<p>\u9664\u4e86\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u70ba\u4e0b\u5283\u7dda\u5b57\u7b26\u4e32\u5916\uff0cisSnakeCase \u51fd\u6578\u9084\u53ef\u4ee5\u6aa2\u67e5\u5b57\u4e32\u4e2d\u662f\u5426\u6709\u975e\u6cd5\u5b57\u7b26\uff0c\u4f8b\u5982\u7a7a\u683c\u3001\u6578\u5b57\u7b49\u3002\u5982\u679c\u5b57\u4e32\u4e2d\u6709\u975e\u6cd5\u5b57\u7b26\uff0c\u51fd\u6578\u6703\u8fd4\u56de false\uff0c\u8868\u793a\u8a72\u5b57\u4e32\u4e0d\u662f\u4e0b\u5283\u7dda\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff1a<\/p>\n<pre class=\"brush: typescript\">\nlet isSnakeCase = isSnakeCase(\"hello world\");\nconsole.log(isSnakeCase); \/\/ false\n<\/pre>\n<p>isSnakeCase \u51fd\u6578\u975e\u5e38\u5be6\u7528\uff0c\u53ef\u4ee5\u7528\u4f86\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u7b26\u5408\u67d0\u7a2e\u898f\u5247\uff0c\u4f8b\u5982\u547d\u540d\u898f\u5247\u7b49\u3002\u5b83\u53ef\u4ee5\u5e6b\u52a9\u958b\u767c\u8005\u66f4\u597d\u5730\u63a7\u5236\u7a0b\u5f0f\u78bc\u7684\u54c1\u8cea\uff0c\u78ba\u4fdd\u7a0b\u5f0f\u78bc\u7684\u53ef\u8b80\u6027\u548c\u53ef\u7dad\u8b77\u6027\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u6b64\u5916\uff0cisSnakeCase \u51fd\u6578\u9084\u53ef\u4ee5\u7528\u65bc\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u7b26\u5408\u67d0\u7a2e\u683c\u5f0f\uff0c\u4f8b\u5982 JSON \u683c\u5f0f\u7b49\u3002\u9019\u6a23\u53ef\u4ee5\u78ba\u4fdd\u5b57\u4e32\u7684\u683c\u5f0f\u6b63\u78ba\uff0c\u907f\u514d\u51fa\u73fe\u4e0d\u5fc5\u8981\u7684\u932f\u8aa4\u3002<\/p>\n<p>\u7e3d\u4e4b\uff0cisSnakeCase \u51fd\u6578\u662f\u4e00\u500b\u975e\u5e38\u5be6\u7528\u7684\u51fd\u6578\uff0c\u53ef\u4ee5\u7528\u4f86\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u70ba\u4e0b\u5283\u7dda\u5b57\u7b26\u4e32\uff0c\u4ee5\u53ca\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u7b26\u5408\u67d0\u7a2e\u898f\u5247\u6216\u683c\u5f0f\u3002\u5b83\u53ef\u4ee5\u5e6b\u52a9\u958b\u767c\u8005\u66f4\u597d\u5730\u63a7\u5236\u7a0b\u5f0f\u78bc\u7684\u54c1\u8cea\uff0c\u78ba\u4fdd\u7a0b\u5f0f\u78bc\u7684\u53ef\u8b80\u6027\u548c\u53ef\u7dad\u8b77\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>2.\u5b78\u7fd2\u5982\u4f55\u4f7f\u7528TypeScript\u4e2d\u7684isSnakeCase\u5b57\u4e32\u6c42\u503c\u529f\u80fd\uff0c\u77ad\u89e3\u5982\u4f55\u5224\u65b7\u5b57\u4e32\u662f\u5426\u70ba\u4e0b\u5283\u7dda\u5b57\u7b26\u4e32\uff0c\u4ee5\u53ca\u5982\u4f55\u61c9\u7528\u65bc\u7a0b\u5f0f\u958b\u767c\u4e2d\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[187],"tags":[186],"class_list":["post-5308","post","type-post","status-publish","format-standard","hentry","category-typescript","tag-typescript"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pcFK27-1nC","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5308","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/comments?post=5308"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5308\/revisions"}],"predecessor-version":[{"id":5309,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5308\/revisions\/5309"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=5308"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=5308"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=5308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}