{
    "componentChunkName": "component---packages-blog-gatsby-blog-core-src-templates-post-js",
    "path": "/autoimport-react-using-webpacks-provideplugin/",
    "result": {"data":{"post":{"id":"af206b04-ee24-5784-8788-a0e0daa43fb0","title":"Autoimport React using Webpack’s ProvidePlugin","slug":"/autoimport-react-using-webpacks-provideplugin/","link":null,"excerpt":"Problem: It is common to import the above line if you are working with any ReactJS project. Over…","tableOfContents":{},"timeToRead":1,"featured":null,"protected":null,"thumbnailText":"Autoimport React","date":"October 29, 2021","category":{"id":"3856cda4-0ed3-5ae2-908c-3e2fc3b15e99","name":"Frontend Cheetseat","slug":"/category/frontend-cheetseat/","color":null,"icon":"/static/e7a8a2e33efdfbfea4396ca0b5d1686c/cheet.svg"},"author":{"id":"947e8b57-e3c9-5b4b-9872-fc27eb54f257","name":"Suresh Kumar Mukhiya","slug":"/author/suresh-kumar-mukhiya/","title":"Software Engineer","description":"Researcher by chance. I prefer green food and nice code. Artificial Intelligence, Big data and Frontend Technologies fascinates me. I like taking pictures.","skills":["Software Architecture","Frontend Development","Natural Language Processing"],"social":[{"name":"Github","url":"http://github.com/sureshHARDIYA/"},{"name":"Twitter","url":"https://twitter.com/dr_code_skm"},{"name":"Website","url":"https://www.skmukhiya.com.np/"}],"thumbnail":{"__typename":"ImageSharp","ImageSharp_small":{"layout":"fixed","placeholder":{"fallback":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='150'%20height='150'%20viewBox='0%200%20150%20150'%20preserveAspectRatio='none'%3e%3cpath%20d='M63%202a74%2074%200%201041%20142c8-4%208-4%205-5l-3-2c0-2%203-2%206-1%203%202%204%202%2011-4A74%2074%200%200063%202M41%2058c-19%208-25%2017-26%2035l-1%2011c-2%205%208%2010%2019%2010h6l-1-4-1-5%202-9%201%201%202%202%202%202c0%202%201%202%204%202%203-1%205%200%207%201%207%204%2016%201%2022-8l2-2-1%202-1%203h13c4-1%204-1%206-7%201-2%201-4%202-3l3%201%202%201%202%201c3%200%205%203%204%204l-1%206v5h5c6%200%2013-3%2013-6l-2-8c-1-8-5-19-8-21-2-3-15-12-19-12-1-1-3-1-4%201l-4%201c-1-1-2%200-3%202v3c3%201-3%2018-8%2022-4%203-4%201%200-3%205-6%204-8-2-3-8%208-8%208-14%202-4-4-5-5-5-3v3l-3-10c0-8-3-20-4-20l-9%203m62%2058l-6%204h-2c0-2-3-1-4%201%200%203%202%206%208%207l7%203c4%202%209%202%207-1l-3-8c-3-8-3-8-7-6m-15%2014c-1%205-1%206%204%207h8c7-2%206-2-2-6-11-5-10-5-10-1'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e"},"images":{"fallback":{"src":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a7a66/suresh.png","srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a7a66/suresh.png 48w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/416a0/suresh.png 96w","sizes":"48px"},"sources":[{"srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a3542/suresh.webp 48w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/0f66d/suresh.webp 96w","type":"image/webp","sizes":"48px"}]},"width":48,"height":48},"ImageSharp_regular":{"layout":"fixed","placeholder":{"fallback":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='150'%20height='150'%20viewBox='0%200%20150%20150'%20preserveAspectRatio='none'%3e%3cpath%20d='M63%202a74%2074%200%201041%20142c8-4%208-4%205-5l-3-2c0-2%203-2%206-1%203%202%204%202%2011-4A74%2074%200%200063%202M41%2058c-19%208-25%2017-26%2035l-1%2011c-2%205%208%2010%2019%2010h6l-1-4-1-5%202-9%201%201%202%202%202%202c0%202%201%202%204%202%203-1%205%200%207%201%207%204%2016%201%2022-8l2-2-1%202-1%203h13c4-1%204-1%206-7%201-2%201-4%202-3l3%201%202%201%202%201c3%200%205%203%204%204l-1%206v5h5c6%200%2013-3%2013-6l-2-8c-1-8-5-19-8-21-2-3-15-12-19-12-1-1-3-1-4%201l-4%201c-1-1-2%200-3%202v3c3%201-3%2018-8%2022-4%203-4%201%200-3%205-6%204-8-2-3-8%208-8%208-14%202-4-4-5-5-5-3v3l-3-10c0-8-3-20-4-20l-9%203m62%2058l-6%204h-2c0-2-3-1-4%201%200%203%202%206%208%207l7%203c4%202%209%202%207-1l-3-8c-3-8-3-8-7-6m-15%2014c-1%205-1%206%204%207h8c7-2%206-2-2-6-11-5-10-5-10-1'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e"},"images":{"fallback":{"src":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/46e60/suresh.png","srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/46e60/suresh.png 150w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/d612b/suresh.png 300w","sizes":"150px"},"sources":[{"srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/ae23d/suresh.webp 150w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/bd37b/suresh.webp 300w","type":"image/webp","sizes":"150px"}]},"width":150,"height":150}}},"body":"var _excluded = [\"components\"];\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"Autoimport React using Webpack’s ProvidePlugin\",\n  \"category\": \"Frontend Cheetseat\",\n  \"date\": \"2021-10-29T00:00:00.000Z\",\n  \"tags\": [\"Webpack\"],\n  \"author\": \"Suresh Kumar Mukhiya\",\n  \"thumbnailText\": \"Autoimport React\"\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, _excluded);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"h3\", {\n    \"id\": \"problem\"\n  }, \"Problem:\"), mdx(\"p\", null, \"It is common to import the above line if you are working with any ReactJS project. Over time, I found it repetitive and cumbersome. I started to see if the import could be done automatically, and guess what? We can by using \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://webpack.js.org/plugins/provide-plugin/\"\n  }, \"ProvidePlugin\"), \" from the webpack.\"), mdx(\"p\", null, \"To get it working, here is what you should do. First, configure your webpack.config.js file as shown below:\"), mdx(\"h3\", {\n    \"id\": \"webpackconfigjs-webpack\"\n  }, \"webpack.config.js \", \"[Webpack]\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"var path = require('path')\\nvar webpack = require('webpack')\\n\\nmodule.exports = {\\n  devtool: 'eval',\\n  entry: [\\n    'webpack-dev-server/client?http://localhost:3000',\\n    'webpack/hot/only-dev-server',\\n    './src/index'\\n  ],\\n  output: {\\n    path: path.join(__dirname, 'dist'),\\n    filename: 'bundle.js',\\n    publicPath: '/'\\n  },\\n  plugins: [\\n    new webpack.HotModuleReplacementPlugin(),\\n    new webpack.ProvidePlugin({\\n      React: 'react'\\n    })\\n  ],\\n  module: {\\n    loaders: [\\n      {\\n        test: /\\\\.js$/,\\n        loaders: ['react-hot', 'babel'],\\n        include: path.join(__dirname, 'src')\\n      }\\n    ]\\n  }\\n}\\n\")), mdx(\"h3\", {\n    \"id\": \"jestsetupjs-jest\"\n  }, \"jest.setup.js \", \"[JEST]\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"// ProvidePlugin for our tests using a global variable\\nwindow.React = require('react')\\n\\n// other jest setup\\n\")), mdx(\"h3\", {\n    \"id\": \"tsconfigjson-typescript\"\n  }, \"tsconfig.json \", \"[TypeScript]\"), mdx(\"p\", null, \"If you have TypeScript setup, we want to make it work with the ProvidePlugin.\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"{\\n\\\"compilerOptions\\\": {\\n\\\"allowUmdGlobalAccess\\\": true, // make typescript work with ProvidePlugin\\n// other compiler options\\n},\\n\\n// other ts config\\n}\\n\")), mdx(\"h3\", {\n    \"id\": \"eslintrcjs-eslint\"\n  }, \".eslintrc.js \", \"[ESLINT]\"), mdx(\"p\", null, \"Once React is auto imported on all files, we often warn developers not to import React in each file. We can throw eslint warning or errors by setting up a rule as follows:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-javascript\"\n  }, \"module.exports = {\\n  rules: {\\n    // Prevent default react imports like import React from 'react'\\n    // but still allows other named react imports.\\n    'no-restricted-imports': [\\n      'error',\\n      {\\n        paths: [\\n          {\\n            name: 'react',\\n            importNames: ['default'],\\n            message: 'React default is automatically imported by webpack.'\\n          }\\n        ]\\n      }\\n    ]\\n\\n    // other eslint rules\\n  }\\n}\\n\")), mdx(\"p\", null, \"These configurations saved a lot of time and became handy over time. I hope someone finds this interesting and helpful. Happy Coding!\"));\n}\n;\nMDXContent.isMDXComponent = true;","keywords":null,"tags":[{"id":"14faf57b-da96-517a-baa2-32b356896a95","name":"Webpack","slug":"/tag/webpack/"}],"thumbnail":null},"tagCategoryPosts":{"nodes":[]},"tagPosts":{"nodes":[]},"categoryPosts":{"nodes":[{"id":"62dc7bd7-0f5a-509e-9a38-5e451324cb46","title":"Roadmap for frontend developer in 2023","slug":"/roadmap-for-frontend-developer-in-2023/","link":null,"excerpt":"Abstract The field of front-end development has evolved significantly over the years. With the rise…","timeToRead":5,"featured":null,"thumbnailText":"Roadmap for frontend developer in 2023","date":"March 07, 2023","category":{"id":"3856cda4-0ed3-5ae2-908c-3e2fc3b15e99","name":"Frontend Cheetseat","slug":"/category/frontend-cheetseat/","color":null,"icon":"/static/e7a8a2e33efdfbfea4396ca0b5d1686c/cheet.svg"},"author":{"id":"947e8b57-e3c9-5b4b-9872-fc27eb54f257","name":"Suresh Kumar Mukhiya","slug":"/author/suresh-kumar-mukhiya/","title":"Software Engineer","description":"Researcher by chance. I prefer green food and nice code. Artificial Intelligence, Big data and Frontend Technologies fascinates me. I like taking pictures.","skills":["Software Architecture","Frontend Development","Natural Language Processing"],"social":[{"name":"Github","url":"http://github.com/sureshHARDIYA/"},{"name":"Twitter","url":"https://twitter.com/dr_code_skm"},{"name":"Website","url":"https://www.skmukhiya.com.np/"}],"thumbnail":{"__typename":"ImageSharp","ImageSharp_small":{"layout":"fixed","placeholder":{"fallback":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='150'%20height='150'%20viewBox='0%200%20150%20150'%20preserveAspectRatio='none'%3e%3cpath%20d='M63%202a74%2074%200%201041%20142c8-4%208-4%205-5l-3-2c0-2%203-2%206-1%203%202%204%202%2011-4A74%2074%200%200063%202M41%2058c-19%208-25%2017-26%2035l-1%2011c-2%205%208%2010%2019%2010h6l-1-4-1-5%202-9%201%201%202%202%202%202c0%202%201%202%204%202%203-1%205%200%207%201%207%204%2016%201%2022-8l2-2-1%202-1%203h13c4-1%204-1%206-7%201-2%201-4%202-3l3%201%202%201%202%201c3%200%205%203%204%204l-1%206v5h5c6%200%2013-3%2013-6l-2-8c-1-8-5-19-8-21-2-3-15-12-19-12-1-1-3-1-4%201l-4%201c-1-1-2%200-3%202v3c3%201-3%2018-8%2022-4%203-4%201%200-3%205-6%204-8-2-3-8%208-8%208-14%202-4-4-5-5-5-3v3l-3-10c0-8-3-20-4-20l-9%203m62%2058l-6%204h-2c0-2-3-1-4%201%200%203%202%206%208%207l7%203c4%202%209%202%207-1l-3-8c-3-8-3-8-7-6m-15%2014c-1%205-1%206%204%207h8c7-2%206-2-2-6-11-5-10-5-10-1'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e"},"images":{"fallback":{"src":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a7a66/suresh.png","srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a7a66/suresh.png 48w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/416a0/suresh.png 96w","sizes":"48px"},"sources":[{"srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a3542/suresh.webp 48w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/0f66d/suresh.webp 96w","type":"image/webp","sizes":"48px"}]},"width":48,"height":48},"ImageSharp_regular":{"layout":"fixed","placeholder":{"fallback":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='150'%20height='150'%20viewBox='0%200%20150%20150'%20preserveAspectRatio='none'%3e%3cpath%20d='M63%202a74%2074%200%201041%20142c8-4%208-4%205-5l-3-2c0-2%203-2%206-1%203%202%204%202%2011-4A74%2074%200%200063%202M41%2058c-19%208-25%2017-26%2035l-1%2011c-2%205%208%2010%2019%2010h6l-1-4-1-5%202-9%201%201%202%202%202%202c0%202%201%202%204%202%203-1%205%200%207%201%207%204%2016%201%2022-8l2-2-1%202-1%203h13c4-1%204-1%206-7%201-2%201-4%202-3l3%201%202%201%202%201c3%200%205%203%204%204l-1%206v5h5c6%200%2013-3%2013-6l-2-8c-1-8-5-19-8-21-2-3-15-12-19-12-1-1-3-1-4%201l-4%201c-1-1-2%200-3%202v3c3%201-3%2018-8%2022-4%203-4%201%200-3%205-6%204-8-2-3-8%208-8%208-14%202-4-4-5-5-5-3v3l-3-10c0-8-3-20-4-20l-9%203m62%2058l-6%204h-2c0-2-3-1-4%201%200%203%202%206%208%207l7%203c4%202%209%202%207-1l-3-8c-3-8-3-8-7-6m-15%2014c-1%205-1%206%204%207h8c7-2%206-2-2-6-11-5-10-5-10-1'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e"},"images":{"fallback":{"src":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/46e60/suresh.png","srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/46e60/suresh.png 150w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/d612b/suresh.png 300w","sizes":"150px"},"sources":[{"srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/ae23d/suresh.webp 150w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/bd37b/suresh.webp 300w","type":"image/webp","sizes":"150px"}]},"width":150,"height":150}}},"thumbnail":null},{"id":"417ad6e4-fb19-5c5f-afe2-c13efae6bc1d","title":"Insert Property and values at specific position in an Object in JavaScript","slug":"/insert-property-and-values-at-specific-position-in-an-object-in-javascript/","link":null,"excerpt":"Problem: Given an object, we would like to insert a property and value at spcific position. Input…","timeToRead":1,"featured":null,"thumbnailText":"Insert property and value at a specific position","date":"December 26, 2021","category":{"id":"3856cda4-0ed3-5ae2-908c-3e2fc3b15e99","name":"Frontend Cheetseat","slug":"/category/frontend-cheetseat/","color":null,"icon":"/static/e7a8a2e33efdfbfea4396ca0b5d1686c/cheet.svg"},"author":{"id":"947e8b57-e3c9-5b4b-9872-fc27eb54f257","name":"Suresh Kumar Mukhiya","slug":"/author/suresh-kumar-mukhiya/","title":"Software Engineer","description":"Researcher by chance. I prefer green food and nice code. Artificial Intelligence, Big data and Frontend Technologies fascinates me. I like taking pictures.","skills":["Software Architecture","Frontend Development","Natural Language Processing"],"social":[{"name":"Github","url":"http://github.com/sureshHARDIYA/"},{"name":"Twitter","url":"https://twitter.com/dr_code_skm"},{"name":"Website","url":"https://www.skmukhiya.com.np/"}],"thumbnail":{"__typename":"ImageSharp","ImageSharp_small":{"layout":"fixed","placeholder":{"fallback":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='150'%20height='150'%20viewBox='0%200%20150%20150'%20preserveAspectRatio='none'%3e%3cpath%20d='M63%202a74%2074%200%201041%20142c8-4%208-4%205-5l-3-2c0-2%203-2%206-1%203%202%204%202%2011-4A74%2074%200%200063%202M41%2058c-19%208-25%2017-26%2035l-1%2011c-2%205%208%2010%2019%2010h6l-1-4-1-5%202-9%201%201%202%202%202%202c0%202%201%202%204%202%203-1%205%200%207%201%207%204%2016%201%2022-8l2-2-1%202-1%203h13c4-1%204-1%206-7%201-2%201-4%202-3l3%201%202%201%202%201c3%200%205%203%204%204l-1%206v5h5c6%200%2013-3%2013-6l-2-8c-1-8-5-19-8-21-2-3-15-12-19-12-1-1-3-1-4%201l-4%201c-1-1-2%200-3%202v3c3%201-3%2018-8%2022-4%203-4%201%200-3%205-6%204-8-2-3-8%208-8%208-14%202-4-4-5-5-5-3v3l-3-10c0-8-3-20-4-20l-9%203m62%2058l-6%204h-2c0-2-3-1-4%201%200%203%202%206%208%207l7%203c4%202%209%202%207-1l-3-8c-3-8-3-8-7-6m-15%2014c-1%205-1%206%204%207h8c7-2%206-2-2-6-11-5-10-5-10-1'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e"},"images":{"fallback":{"src":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a7a66/suresh.png","srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a7a66/suresh.png 48w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/416a0/suresh.png 96w","sizes":"48px"},"sources":[{"srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a3542/suresh.webp 48w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/0f66d/suresh.webp 96w","type":"image/webp","sizes":"48px"}]},"width":48,"height":48},"ImageSharp_regular":{"layout":"fixed","placeholder":{"fallback":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='150'%20height='150'%20viewBox='0%200%20150%20150'%20preserveAspectRatio='none'%3e%3cpath%20d='M63%202a74%2074%200%201041%20142c8-4%208-4%205-5l-3-2c0-2%203-2%206-1%203%202%204%202%2011-4A74%2074%200%200063%202M41%2058c-19%208-25%2017-26%2035l-1%2011c-2%205%208%2010%2019%2010h6l-1-4-1-5%202-9%201%201%202%202%202%202c0%202%201%202%204%202%203-1%205%200%207%201%207%204%2016%201%2022-8l2-2-1%202-1%203h13c4-1%204-1%206-7%201-2%201-4%202-3l3%201%202%201%202%201c3%200%205%203%204%204l-1%206v5h5c6%200%2013-3%2013-6l-2-8c-1-8-5-19-8-21-2-3-15-12-19-12-1-1-3-1-4%201l-4%201c-1-1-2%200-3%202v3c3%201-3%2018-8%2022-4%203-4%201%200-3%205-6%204-8-2-3-8%208-8%208-14%202-4-4-5-5-5-3v3l-3-10c0-8-3-20-4-20l-9%203m62%2058l-6%204h-2c0-2-3-1-4%201%200%203%202%206%208%207l7%203c4%202%209%202%207-1l-3-8c-3-8-3-8-7-6m-15%2014c-1%205-1%206%204%207h8c7-2%206-2-2-6-11-5-10-5-10-1'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e"},"images":{"fallback":{"src":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/46e60/suresh.png","srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/46e60/suresh.png 150w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/d612b/suresh.png 300w","sizes":"150px"},"sources":[{"srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/ae23d/suresh.webp 150w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/bd37b/suresh.webp 300w","type":"image/webp","sizes":"150px"}]},"width":150,"height":150}}},"thumbnail":null},{"id":"8c984c34-f062-50f4-a884-181ed4ffdd3c","title":"Fastest way to check if an object is empty","slug":"/fastest-way-to-check-if-an-object-is-empty/","link":null,"excerpt":"Problem: Given an object, the aim is to check weather the object is empty or not. Input: Expected…","timeToRead":1,"featured":null,"thumbnailText":"Is object empty?","date":"October 27, 2021","category":{"id":"3856cda4-0ed3-5ae2-908c-3e2fc3b15e99","name":"Frontend Cheetseat","slug":"/category/frontend-cheetseat/","color":null,"icon":"/static/e7a8a2e33efdfbfea4396ca0b5d1686c/cheet.svg"},"author":{"id":"947e8b57-e3c9-5b4b-9872-fc27eb54f257","name":"Suresh Kumar Mukhiya","slug":"/author/suresh-kumar-mukhiya/","title":"Software Engineer","description":"Researcher by chance. I prefer green food and nice code. Artificial Intelligence, Big data and Frontend Technologies fascinates me. I like taking pictures.","skills":["Software Architecture","Frontend Development","Natural Language Processing"],"social":[{"name":"Github","url":"http://github.com/sureshHARDIYA/"},{"name":"Twitter","url":"https://twitter.com/dr_code_skm"},{"name":"Website","url":"https://www.skmukhiya.com.np/"}],"thumbnail":{"__typename":"ImageSharp","ImageSharp_small":{"layout":"fixed","placeholder":{"fallback":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='150'%20height='150'%20viewBox='0%200%20150%20150'%20preserveAspectRatio='none'%3e%3cpath%20d='M63%202a74%2074%200%201041%20142c8-4%208-4%205-5l-3-2c0-2%203-2%206-1%203%202%204%202%2011-4A74%2074%200%200063%202M41%2058c-19%208-25%2017-26%2035l-1%2011c-2%205%208%2010%2019%2010h6l-1-4-1-5%202-9%201%201%202%202%202%202c0%202%201%202%204%202%203-1%205%200%207%201%207%204%2016%201%2022-8l2-2-1%202-1%203h13c4-1%204-1%206-7%201-2%201-4%202-3l3%201%202%201%202%201c3%200%205%203%204%204l-1%206v5h5c6%200%2013-3%2013-6l-2-8c-1-8-5-19-8-21-2-3-15-12-19-12-1-1-3-1-4%201l-4%201c-1-1-2%200-3%202v3c3%201-3%2018-8%2022-4%203-4%201%200-3%205-6%204-8-2-3-8%208-8%208-14%202-4-4-5-5-5-3v3l-3-10c0-8-3-20-4-20l-9%203m62%2058l-6%204h-2c0-2-3-1-4%201%200%203%202%206%208%207l7%203c4%202%209%202%207-1l-3-8c-3-8-3-8-7-6m-15%2014c-1%205-1%206%204%207h8c7-2%206-2-2-6-11-5-10-5-10-1'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e"},"images":{"fallback":{"src":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a7a66/suresh.png","srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a7a66/suresh.png 48w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/416a0/suresh.png 96w","sizes":"48px"},"sources":[{"srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a3542/suresh.webp 48w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/0f66d/suresh.webp 96w","type":"image/webp","sizes":"48px"}]},"width":48,"height":48},"ImageSharp_regular":{"layout":"fixed","placeholder":{"fallback":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='150'%20height='150'%20viewBox='0%200%20150%20150'%20preserveAspectRatio='none'%3e%3cpath%20d='M63%202a74%2074%200%201041%20142c8-4%208-4%205-5l-3-2c0-2%203-2%206-1%203%202%204%202%2011-4A74%2074%200%200063%202M41%2058c-19%208-25%2017-26%2035l-1%2011c-2%205%208%2010%2019%2010h6l-1-4-1-5%202-9%201%201%202%202%202%202c0%202%201%202%204%202%203-1%205%200%207%201%207%204%2016%201%2022-8l2-2-1%202-1%203h13c4-1%204-1%206-7%201-2%201-4%202-3l3%201%202%201%202%201c3%200%205%203%204%204l-1%206v5h5c6%200%2013-3%2013-6l-2-8c-1-8-5-19-8-21-2-3-15-12-19-12-1-1-3-1-4%201l-4%201c-1-1-2%200-3%202v3c3%201-3%2018-8%2022-4%203-4%201%200-3%205-6%204-8-2-3-8%208-8%208-14%202-4-4-5-5-5-3v3l-3-10c0-8-3-20-4-20l-9%203m62%2058l-6%204h-2c0-2-3-1-4%201%200%203%202%206%208%207l7%203c4%202%209%202%207-1l-3-8c-3-8-3-8-7-6m-15%2014c-1%205-1%206%204%207h8c7-2%206-2-2-6-11-5-10-5-10-1'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e"},"images":{"fallback":{"src":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/46e60/suresh.png","srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/46e60/suresh.png 150w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/d612b/suresh.png 300w","sizes":"150px"},"sources":[{"srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/ae23d/suresh.webp 150w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/bd37b/suresh.webp 300w","type":"image/webp","sizes":"150px"}]},"width":150,"height":150}}},"thumbnail":null},{"id":"57195799-b9d9-5d67-bdf7-33a6e09708e2","title":"Concatenate array of objects inside an array of objects","slug":"/concatenate-array-of-objects-inside-an-array-of-objects/","link":null,"excerpt":"Problem: Given an array of objects, we want to concatenate nested array of objects. Look at the…","timeToRead":1,"featured":null,"thumbnailText":"Concatenate array of objects","date":"October 26, 2021","category":{"id":"3856cda4-0ed3-5ae2-908c-3e2fc3b15e99","name":"Frontend Cheetseat","slug":"/category/frontend-cheetseat/","color":null,"icon":"/static/e7a8a2e33efdfbfea4396ca0b5d1686c/cheet.svg"},"author":{"id":"947e8b57-e3c9-5b4b-9872-fc27eb54f257","name":"Suresh Kumar Mukhiya","slug":"/author/suresh-kumar-mukhiya/","title":"Software Engineer","description":"Researcher by chance. I prefer green food and nice code. Artificial Intelligence, Big data and Frontend Technologies fascinates me. I like taking pictures.","skills":["Software Architecture","Frontend Development","Natural Language Processing"],"social":[{"name":"Github","url":"http://github.com/sureshHARDIYA/"},{"name":"Twitter","url":"https://twitter.com/dr_code_skm"},{"name":"Website","url":"https://www.skmukhiya.com.np/"}],"thumbnail":{"__typename":"ImageSharp","ImageSharp_small":{"layout":"fixed","placeholder":{"fallback":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='150'%20height='150'%20viewBox='0%200%20150%20150'%20preserveAspectRatio='none'%3e%3cpath%20d='M63%202a74%2074%200%201041%20142c8-4%208-4%205-5l-3-2c0-2%203-2%206-1%203%202%204%202%2011-4A74%2074%200%200063%202M41%2058c-19%208-25%2017-26%2035l-1%2011c-2%205%208%2010%2019%2010h6l-1-4-1-5%202-9%201%201%202%202%202%202c0%202%201%202%204%202%203-1%205%200%207%201%207%204%2016%201%2022-8l2-2-1%202-1%203h13c4-1%204-1%206-7%201-2%201-4%202-3l3%201%202%201%202%201c3%200%205%203%204%204l-1%206v5h5c6%200%2013-3%2013-6l-2-8c-1-8-5-19-8-21-2-3-15-12-19-12-1-1-3-1-4%201l-4%201c-1-1-2%200-3%202v3c3%201-3%2018-8%2022-4%203-4%201%200-3%205-6%204-8-2-3-8%208-8%208-14%202-4-4-5-5-5-3v3l-3-10c0-8-3-20-4-20l-9%203m62%2058l-6%204h-2c0-2-3-1-4%201%200%203%202%206%208%207l7%203c4%202%209%202%207-1l-3-8c-3-8-3-8-7-6m-15%2014c-1%205-1%206%204%207h8c7-2%206-2-2-6-11-5-10-5-10-1'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e"},"images":{"fallback":{"src":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a7a66/suresh.png","srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a7a66/suresh.png 48w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/416a0/suresh.png 96w","sizes":"48px"},"sources":[{"srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a3542/suresh.webp 48w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/0f66d/suresh.webp 96w","type":"image/webp","sizes":"48px"}]},"width":48,"height":48},"ImageSharp_regular":{"layout":"fixed","placeholder":{"fallback":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='150'%20height='150'%20viewBox='0%200%20150%20150'%20preserveAspectRatio='none'%3e%3cpath%20d='M63%202a74%2074%200%201041%20142c8-4%208-4%205-5l-3-2c0-2%203-2%206-1%203%202%204%202%2011-4A74%2074%200%200063%202M41%2058c-19%208-25%2017-26%2035l-1%2011c-2%205%208%2010%2019%2010h6l-1-4-1-5%202-9%201%201%202%202%202%202c0%202%201%202%204%202%203-1%205%200%207%201%207%204%2016%201%2022-8l2-2-1%202-1%203h13c4-1%204-1%206-7%201-2%201-4%202-3l3%201%202%201%202%201c3%200%205%203%204%204l-1%206v5h5c6%200%2013-3%2013-6l-2-8c-1-8-5-19-8-21-2-3-15-12-19-12-1-1-3-1-4%201l-4%201c-1-1-2%200-3%202v3c3%201-3%2018-8%2022-4%203-4%201%200-3%205-6%204-8-2-3-8%208-8%208-14%202-4-4-5-5-5-3v3l-3-10c0-8-3-20-4-20l-9%203m62%2058l-6%204h-2c0-2-3-1-4%201%200%203%202%206%208%207l7%203c4%202%209%202%207-1l-3-8c-3-8-3-8-7-6m-15%2014c-1%205-1%206%204%207h8c7-2%206-2-2-6-11-5-10-5-10-1'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e"},"images":{"fallback":{"src":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/46e60/suresh.png","srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/46e60/suresh.png 150w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/d612b/suresh.png 300w","sizes":"150px"},"sources":[{"srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/ae23d/suresh.webp 150w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/bd37b/suresh.webp 300w","type":"image/webp","sizes":"150px"}]},"width":150,"height":150}}},"thumbnail":null},{"id":"df89ef5b-b0a9-5f9b-ae9e-1d12ce560184","title":"Group Array of Objects by Key","slug":"/group-array-of-objects-by-key/","link":null,"excerpt":"Problem: Given an arry of objects, we need to group objects by any key. Input: Expected Output…","timeToRead":1,"featured":null,"thumbnailText":"Group array of objects","date":"October 05, 2021","category":{"id":"3856cda4-0ed3-5ae2-908c-3e2fc3b15e99","name":"Frontend Cheetseat","slug":"/category/frontend-cheetseat/","color":null,"icon":"/static/e7a8a2e33efdfbfea4396ca0b5d1686c/cheet.svg"},"author":{"id":"947e8b57-e3c9-5b4b-9872-fc27eb54f257","name":"Suresh Kumar Mukhiya","slug":"/author/suresh-kumar-mukhiya/","title":"Software Engineer","description":"Researcher by chance. I prefer green food and nice code. Artificial Intelligence, Big data and Frontend Technologies fascinates me. I like taking pictures.","skills":["Software Architecture","Frontend Development","Natural Language Processing"],"social":[{"name":"Github","url":"http://github.com/sureshHARDIYA/"},{"name":"Twitter","url":"https://twitter.com/dr_code_skm"},{"name":"Website","url":"https://www.skmukhiya.com.np/"}],"thumbnail":{"__typename":"ImageSharp","ImageSharp_small":{"layout":"fixed","placeholder":{"fallback":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='150'%20height='150'%20viewBox='0%200%20150%20150'%20preserveAspectRatio='none'%3e%3cpath%20d='M63%202a74%2074%200%201041%20142c8-4%208-4%205-5l-3-2c0-2%203-2%206-1%203%202%204%202%2011-4A74%2074%200%200063%202M41%2058c-19%208-25%2017-26%2035l-1%2011c-2%205%208%2010%2019%2010h6l-1-4-1-5%202-9%201%201%202%202%202%202c0%202%201%202%204%202%203-1%205%200%207%201%207%204%2016%201%2022-8l2-2-1%202-1%203h13c4-1%204-1%206-7%201-2%201-4%202-3l3%201%202%201%202%201c3%200%205%203%204%204l-1%206v5h5c6%200%2013-3%2013-6l-2-8c-1-8-5-19-8-21-2-3-15-12-19-12-1-1-3-1-4%201l-4%201c-1-1-2%200-3%202v3c3%201-3%2018-8%2022-4%203-4%201%200-3%205-6%204-8-2-3-8%208-8%208-14%202-4-4-5-5-5-3v3l-3-10c0-8-3-20-4-20l-9%203m62%2058l-6%204h-2c0-2-3-1-4%201%200%203%202%206%208%207l7%203c4%202%209%202%207-1l-3-8c-3-8-3-8-7-6m-15%2014c-1%205-1%206%204%207h8c7-2%206-2-2-6-11-5-10-5-10-1'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e"},"images":{"fallback":{"src":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a7a66/suresh.png","srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a7a66/suresh.png 48w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/416a0/suresh.png 96w","sizes":"48px"},"sources":[{"srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/a3542/suresh.webp 48w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/0f66d/suresh.webp 96w","type":"image/webp","sizes":"48px"}]},"width":48,"height":48},"ImageSharp_regular":{"layout":"fixed","placeholder":{"fallback":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='150'%20height='150'%20viewBox='0%200%20150%20150'%20preserveAspectRatio='none'%3e%3cpath%20d='M63%202a74%2074%200%201041%20142c8-4%208-4%205-5l-3-2c0-2%203-2%206-1%203%202%204%202%2011-4A74%2074%200%200063%202M41%2058c-19%208-25%2017-26%2035l-1%2011c-2%205%208%2010%2019%2010h6l-1-4-1-5%202-9%201%201%202%202%202%202c0%202%201%202%204%202%203-1%205%200%207%201%207%204%2016%201%2022-8l2-2-1%202-1%203h13c4-1%204-1%206-7%201-2%201-4%202-3l3%201%202%201%202%201c3%200%205%203%204%204l-1%206v5h5c6%200%2013-3%2013-6l-2-8c-1-8-5-19-8-21-2-3-15-12-19-12-1-1-3-1-4%201l-4%201c-1-1-2%200-3%202v3c3%201-3%2018-8%2022-4%203-4%201%200-3%205-6%204-8-2-3-8%208-8%208-14%202-4-4-5-5-5-3v3l-3-10c0-8-3-20-4-20l-9%203m62%2058l-6%204h-2c0-2-3-1-4%201%200%203%202%206%208%207l7%203c4%202%209%202%207-1l-3-8c-3-8-3-8-7-6m-15%2014c-1%205-1%206%204%207h8c7-2%206-2-2-6-11-5-10-5-10-1'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e"},"images":{"fallback":{"src":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/46e60/suresh.png","srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/46e60/suresh.png 150w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/d612b/suresh.png 300w","sizes":"150px"},"sources":[{"srcSet":"/static/f5daa173e29dcd3a2863e27fd1dbc2d1/ae23d/suresh.webp 150w,\n/static/f5daa173e29dcd3a2863e27fd1dbc2d1/bd37b/suresh.webp 300w","type":"image/webp","sizes":"150px"}]},"width":150,"height":150}}},"thumbnail":null}]},"previous":{"id":"8c984c34-f062-50f4-a884-181ed4ffdd3c","slug":"/fastest-way-to-check-if-an-object-is-empty/","title":"Fastest way to check if an object is empty"},"next":{"id":"417ad6e4-fb19-5c5f-afe2-c13efae6bc1d","slug":"/insert-property-and-values-at-specific-position-in-an-object-in-javascript/","title":"Insert Property and values at specific position in an Object in JavaScript"}},"pageContext":{"id":"af206b04-ee24-5784-8788-a0e0daa43fb0","categoryId":"3856cda4-0ed3-5ae2-908c-3e2fc3b15e99","tagsIds":["14faf57b-da96-517a-baa2-32b356896a95"],"hasTags":true,"previousId":"8c984c34-f062-50f4-a884-181ed4ffdd3c","nextId":"417ad6e4-fb19-5c5f-afe2-c13efae6bc1d","paginatePostsPage":true,"basePath":"/","services":{"algolia":true,"mailchimp":false,"disqus":true,"graphComment":false,"facebookComment":false},"siteUrl":null,"mobileMenu":{"title":"Topics","items":[{"name":"Artificial Intelligence","slug":"/category/artificial-intelligence/"},{"name":"Frontend Cheetseat","slug":"/category/frontend-cheetseat/"},{"name":"My Philosophy","slug":"/category/my-philosophy/"},{"name":"Paper Review","slug":"/category/paper-review/"},{"name":"Research Methods","slug":"/category/research-methods/"},{"name":"Software Architecture","slug":"/category/software-architecture/"}]},"darkMode":true,"includeExcerpt":true,"includeTimeToRead":true,"includeTableOfContents":true,"imageQuality":75}},
    "staticQueryHashes": ["1992822086","2409295108","2918496967","2981853053","4235339838","4240507859"]}