{"id":8030,"date":"2019-11-22T10:00:42","date_gmt":"2019-11-22T01:00:42","guid":{"rendered":"https:\/\/www.gigas-jp.com\/appnews\/?p=8030"},"modified":"2019-11-21T19:44:14","modified_gmt":"2019-11-21T10:44:14","slug":"introduction-to-loadash-js-and-its-identity-property-part-1","status":"publish","type":"post","link":"https:\/\/www.gigas-jp.com\/appnews\/archives\/8030","title":{"rendered":"Introduction to Loadash Js and its `identity` property (part 1)"},"content":{"rendered":"\n<h4>What is Lodash<\/h4>\n\n\n\n<p>Lodash is a JavaScript library which provides utility functions for common programming tasks, delivering consistency, modularity and performance etc and it provides simple to use methods that solve common problems. <\/p>\n\n\n\n<h4>Why Lodash<\/h4>\n\n\n\n<ul><li>Provides consistent cross browser support.<\/li><li>Able to use both for frontend &amp; backend.<\/li><li>Lodash can follow DRY principle.<\/li><li>Performance and optimization for speed is better rather than native and more readable.<\/li><li>Declarative type.<\/li><li>Have good amount of contributors and active in their respositories.<\/li><li>Support every browser basically.<\/li><\/ul>\n\n\n\n<h4>How<\/h4>\n\n\n\n<ul><li>Can use locally or globally<\/li><li>Can also go through with npm<\/li><li>For backend use, have to require lodash in code.<\/li><\/ul>\n\n\n\n<p>I will introduce with a property called identity using in lodash js<\/p>\n\n\n\n<h4>Identity<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>var res = _.identity('hlaing', 'tin');\n\/\/ res is hlaing<\/code><\/pre>\n\n\n\n<p> Method returns the first argument <\/p>\n\n\n\n<h4>_.identity in documentation of _.findKey and _.findLastKey<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>var data = {\n    topic: \"lodash\",\n    desc: \"js library\",\n    awesome: \"chaining\"\n};\n\nvar keyRes = _.findKey(p);        \/\/ returns \"topic\"\nvar lastKeyRes = _.findLastKey(p);    \/\/ returns \"awesome\"\n\n\/\/ same with above \nvar keyRes = _.findKey(p, _.identity);\nvar lastKeyRes = _.findLastKey(p, _.identity);\n\n\/\/ which again means the same scenario:\nvar keyRes = _.findKey(p, function(x) { return x; }\nvar lastKeyRes = _.findLastKey(p, function(x) { return x; }<\/code><\/pre>\n\n\n\n<p>I introduced the identity property this week and will introduce the rest functionalities in coming weeks.<\/p>\n\n\n\n<p>By Yuuma<\/p>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/8030\" ><\/g:plusone><\/div>\n            <div class=\"wsbl_hatena_button\"><a href=\"\/\/b.hatena.ne.jp\/entry\/https:\/\/www.gigas-jp.com\/appnews\/archives\/8030\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"Introduction to Loadash Js and its `identity` property (part 1)\" data-hatena-bookmark-layout=\"standard\" title=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\"> <img src=\"\/\/b.hatena.ne.jp\/images\/entry-button\/button-only@2x.png\" alt=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\" width=\"20\" height=\"20\" style=\"border: none;\" \/><\/a><script type=\"text\/javascript\" src=\"\/\/b.hatena.ne.jp\/js\/bookmark_button.js\" charset=\"utf-8\" async=\"async\"><\/script><\/div>\n            <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/8030\" data-text=\"Introduction to Loadash Js and its `identity` property (part 1)\" data-via=\"GIGASJAPAN_APPS\" data-lang=\"ja\">Tweet<\/a><\/div>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/8030\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_facebook_send\"><div id=\"fb-root\"><\/div><fb:send href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/8030\" colorscheme=\"light\" ><\/fb:send><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>What is Lodash Lodash is a JavaScript library which provides utility functions for common programming tasks, d [&hellip;]<\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[100],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/8030"}],"collection":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/comments?post=8030"}],"version-history":[{"count":3,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/8030\/revisions"}],"predecessor-version":[{"id":8035,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/8030\/revisions\/8035"}],"wp:attachment":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/media?parent=8030"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/categories?post=8030"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/tags?post=8030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}