From 538cabc7b07fdfecc84a9e71f495296aa2f388a2 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 25 Apr 2024 13:05:55 -0500 Subject: [PATCH 1/2] feat(DiffUtil): Add diff util module --- .dockerignore | 2 - Dockerfile | 10 - README.md | 5 + docker-compose.yml | 18 -- docs/assets/navigation.js | 2 +- docs/assets/search.js | 2 +- docs/functions/addDataKeys.html | 7 + docs/functions/addValueArray.html | 4 +- docs/functions/allSettled.html | 4 +- docs/functions/deepImmutable.html | 4 +- docs/functions/diffArray.html | 4 + docs/functions/diffObject.html | 4 + docs/functions/dollarsToPennies.html | 4 +- docs/functions/formatValueToDecimal.html | 4 +- docs/functions/getPercentAsDecimal.html | 4 +- docs/functions/immutableObject.html | 4 +- docs/functions/isArray.html | 4 + docs/functions/isObject.html | 4 +- docs/functions/joinValues.html | 4 +- docs/functions/loopArray.html | 4 +- docs/functions/loopObject.html | 4 +- docs/functions/penniesToDollars.html | 4 +- docs/functions/recursiveCopy.html | 4 +- docs/functions/reflect.html | 4 +- docs/functions/remapData.html | 7 + docs/functions/removeAllLeadingZeros.html | 4 +- docs/functions/removeLastChar.html | 4 +- docs/functions/sanitizeNumInput.html | 4 +- docs/functions/searchDataByKeys.html | 4 +- docs/functions/sliceLeadingZero.html | 4 +- docs/functions/stringToNum.html | 4 +- docs/index.html | 8 +- docs/modules.html | 16 +- docs/types/DiffOptionsType.html | 1 + docs/types/DiffType.html | 1 + docs/types/IntArrayType.html | 1 + docs/types/IntObjectType.html | 1 + docs/types/IntType.html | 1 + docs/types/Nested.html | 2 +- docs/types/UpdateObjectType.html | 1 + docs/types/UpdateType.html | 1 + package-lock.json | 346 ++++++++++++++-------- package.json | 4 +- src/__tests__/diffUtils.test.js | 192 ++++++++++++ src/__tests__/functionUtils.test.js | 52 ++++ src/arrayHelper.ts | 18 +- src/diffUtils.ts | 125 ++++++++ src/functionUtils.ts | 66 +++++ src/index.ts | 2 + tsconfig.json | 2 +- typedoc.json | 3 +- yarn.lock | 311 ++++++++++--------- 52 files changed, 940 insertions(+), 359 deletions(-) delete mode 100644 .dockerignore delete mode 100644 Dockerfile delete mode 100644 docker-compose.yml create mode 100644 docs/functions/addDataKeys.html create mode 100644 docs/functions/diffArray.html create mode 100644 docs/functions/diffObject.html create mode 100644 docs/functions/isArray.html create mode 100644 docs/functions/remapData.html create mode 100644 docs/types/DiffOptionsType.html create mode 100644 docs/types/DiffType.html create mode 100644 docs/types/IntArrayType.html create mode 100644 docs/types/IntObjectType.html create mode 100644 docs/types/IntType.html create mode 100644 docs/types/UpdateObjectType.html create mode 100644 docs/types/UpdateType.html create mode 100644 src/__tests__/diffUtils.test.js create mode 100644 src/__tests__/functionUtils.test.js create mode 100644 src/diffUtils.ts create mode 100644 src/functionUtils.ts diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 27d2dae..0000000 --- a/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -*/node_modules -*.log diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index d369844..0000000 --- a/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM node:8.11.4 - -WORKDIR /app/website - -EXPOSE 3000 35729 -COPY ./docs /app/docs -COPY ./website /app/website -RUN yarn install - -CMD ["yarn", "start"] diff --git a/README.md b/README.md index 083daa7..d2981e3 100644 --- a/README.md +++ b/README.md @@ -71,3 +71,8 @@ Run tests coverage report ```bash npm run test:coverage ``` + +Create typedocs +```bash +npm run typedoc +``` diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 6711192..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: "3" - -services: - docusaurus: - build: . - ports: - - 3000:3000 - - 35729:35729 - volumes: - - ./docs:/app/docs - - ./website/blog:/app/website/blog - - ./website/core:/app/website/core - - ./website/i18n:/app/website/i18n - - ./website/pages:/app/website/pages - - ./website/static:/app/website/static - - ./website/sidebars.json:/app/website/sidebars.json - - ./website/siteConfig.js:/app/website/siteConfig.js - working_dir: /app/website diff --git a/docs/assets/navigation.js b/docs/assets/navigation.js index c69dcec..b91f18f 100644 --- a/docs/assets/navigation.js +++ b/docs/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE42TS0/DMAyA/wrqGTGYeIjdBjuAmAYSgwOIg2k9muEmUeIiCuK/E3WwtcXNuMZfPj9kP34mjO+cjJKxc1DtXCBZdMlukuaKMoc6GT2uEciye6ASazQwFjgPz4tSp6yM9oMWsJdzQYF6VTpLRseHX7trUYZoL4uiZHgmlEQtICJSv8z18xJTllQdJCbzEYvf+p2Msb2TWQe3CPor2EQjCodp6bx6w3NjxTpawB/RU0N1zXn/IhDdIjNhJm7BOtpNEGwE3tcbYEMpwMHQKn9BPe3/hP5nbPZxi+DSfOeOFSmuehqaoedmM1xZ9IPVazvlcP/05OBo2Ejg6wQTYDirrrDyUvVdJjr5+oTil5gZInB+bm5Qa4Vizi4TWZuFcQVwnXduJpiqAkhSSlxE+4J8gy5FzWMfsQpYRLo0StcViE1vohGFXQ0ktLAakSTqMtGjK8wbjommCJnSLw/ojOgUwa3iKXg+z8H1G3+JiMqDVqw+cFYWl9qW4ol1mZiOVIqNLkRdh4np2AVobkJm0bQJC4fz9A1/QxPexAYAAA==" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE42VTU/cMBCG/wrKGZUW9UPdG4VDV0UsEksPRRxMPCGmjm3ZE9S06n+vk+zmw7UnOSbv62dm7Bn74U+G8AuzTXZhLWtOvoI0YLPTLC+F5BZUtnkYLIzz70zW0Fm9xzAs/e+iVjkKrdzZzPCmxEp610+heLb5+P7v6QDiAGZbVTWyJwkx0MxAgMTRs3t6gRxjqMBCwVyysINELiZScIuxpdYmGX0QFwDpDEaVQFjIa+vEK1xqE81jZvgP9DhBXTFkJ/copMAm3Uyt6xs0LtFKR5lMuWKm9cXTPYh0qqIoFlJtLTvTQfeNmTQs+i93FsjzaOdvP3969+E8CJjCrFm/Vdg1Q4wx1VZw+pZIgEZxBSnBWLP63nCGkE4l1Nfx0qQ1DO7PIjmOg0jdcG1PJMdxVMnW3GGZvoulvANECTw6PYMaBvA0yZzrLmHjB9pvCM9mE1XIRNYHaR1xWscdMJuXC0N2Aw6nxfRH1v9dOi7XBWhH/UuTulBCD7nz3StGP4ZcS8ms2+tbUEpANGboIRqm0LZi2MXd6yvIRcVkDBnzEdhnwFuwOfh7wRHUiI2AvmihugyiRY8qgTD9hvgS+i2KgUIP/Q7oV7iQ8hoYF+r5B1gdZUaNi+Br5vCyZDZNPDoIlGNKoPgNN3W1VaaOjljooXBS5DCpIooLPBQOrTfttY8cJY1yZHAe/wF7HpEoRwoAAA==" \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js index 3251f8c..3ad2db7 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE61Yy27bOhD9F2ZrOCZt+bVL203Qoi1wgy5qGAEjM41aShQk2r2u4X/vUA9rqAwTtejKoHjmcDhnOB7yxArzs2TrzYn9SLIdW89nI5bJVLE1+26S7IvUe1WyEdsXGj497rPYJiYrr7vJ8ZNNNSBiLcsSsGvGziOCrpRZYpNf6uM+vc3yvSVI+5Ch1IVKzUHdaP1ByV2SffuqCkM5TeIG+6+TWCFDyv8e5M/8/yBL+/ZJFkHHW8Bgj20BjtwZCCflbDc7lPCbsp9VEavM3pTvVJykUhPEBGroAo+mSKWt8urOhFegYEOX2BmtZVHemc8qyxIyt/uQodR5DQeXagKCug8ZSi21/k9Zq9WOIO0mhyfco1YxdQSbmcF+7XaVDDdFIY+Ua3h+KGmSpnsrH7T69PCd9rKHeJk4iqbzC/f9vT3maiDlVf/jxRqtNGK5LCDZnzs+7m+ETkil8tsWSGUjnh8ucLwvyuSg3pqc0sWbH0qqjclDQl/m/oQsqG83+S+k7bFdofErgiIk8pdO2jKcreWQvaC6rWQRP72TVr45vldHqo70IS9Si8lqwSNx4f+oSosKiYtAeV1//PtwP2O5eiW2jRcdPZ8Ir+CZn6852iwx9sEvLdcKft6OGCyq/mfrEzsoOAomA5AYT8crsHpMlN65tqh2BzhNmjqebTP3BeQ0hUPUkOsJG20mI7EcR2K+3Y42rUU1UX2oYBxGnIJxDyZgJCiY8GBTGE0p2NSDzWA0o2AzDxbBKKJgkQebw2hOweYebAGjBQVbeLAljJYUbOnBQJTNioKt/PC6aHNSB94TolKClsLXgruYc1IN7svBXdg5KQj3FeEu8hw0mYwn0dRH+qJwF3xOysJ9XbiLPyeV4b403EnASXG4rw53KnBSH+4LxFfhHfkaiUojUkzhayScEIJUU/TOS3VgSDWFr5GYBv0UvkbCCSHoU1hrVNUQKB5QV27rWgLVoK16J3bfFBh+qWonBuquT+cRg5hUv7Am/J67AuNGbilonA6ucZL1/y1iE4hNhKxdQcyagtjZCmQrZmHbsm010bITtOwkYOpalaRrZZB1hKyjkHXdEluTt515R7Ds7JcB8/pSUAXNml17d+goFh3FIkABN5e8vrnIkmCYdwzzAMNl96ZpBlAMpigGIdmTkjBcIdVCoXf38UNzWe9MkWghQ9fXPE8yFCweipazJLxFUvGQVkRqcrTJUFo3iQHythesjgAFaRUwvzS9cdUUI5+Rsjwk7eXOhOyQ0/CvEbJzd3c4Vbp+GPhVP06graOdv8gBfY2NqweCzhjVltCBbl9Vsn2a1A8vaAdoAyHzqtXcQav5cPxRdaPIdZRgIkjgXkXQ5jEBOhOhI1G/U1iTuVeMzhJVFLKgQHHOk1zpJAPMZns+/wYkim7o6xIAAA=="; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE61Zy27bOhD9F2VrOCYp27F3abMJbpEWaNrFDYJAsehErSwJEpU2NfLvl6ReQ2nGlm+6MmjOnDmcM3yI3Ht5+qvw1nd772eUhN564U+8JNhJb+39SKPkexCXsvAmXpnH+q9tmWxUlCbFedc5fVa7WFts4qAotO3a894mCFwRJJGK/sibcnedZKVCQPsmY6FzuUtf5GUcf5JBGCVP/8o8xUijdqP5x9FGAkeMf8/kNP6fgkJ9fA5yknhjMJqxyjWR21SnEyPb9Y4FfJLqi8w3MlGXxZXcRLsgRoARq7EBtmm+C5Stq9uUjoCZjQ0RpnEc5MVt+kUmSYTWdt9kLHRWmWtKFQAC3TcZCx3E8VepVCxDBLTrHF9w21husClY94zmFYZWhss8D14xarB/LGi025UqeIzl58cfOMuexWHg+VwsWuyHB/WayZGQZ/0/W28QaeJlQa6LfUh82h8IXpBSZteNIVaNsH+8wJsyL6IX+THNMF2c/rGgcZpmlNBt3ylgpL5d59+Qtod2BtpHBAWWgC9etAWVmrpndPUXdNkXY5ICNgAZ5Jvnq0AFH17/ka/YgtQ3OQjNZ6slm/MW/0YWCqxIJpXFefXn/9dtgHJ2RKSaRQfPZtxZOdNfx4jWIaau8aFwTeVQ+3mQmZziW3nVd8ISa8wJ/UDv6B0w2m6pWm37TgEj67Xr/BvTuId2BtpHKgRYAr50XV8n6nZYkvW/J80Q7WPTicO1XadiViPAQbu+987BIdixqehSo4fwLQsDJRH+XcdJKancyKz0u9+bGBTvWG4GHOnhXOkiRYbR/H1SaozT58zOIAIS9L43MRjcsbz0CR5ax78lodxGiQxvyjgeH3uKOo+iM1znHVabNHmRuTKIt2kb4ARmJMBp7O4nniYnf3vrvafxCm2grflUTFfafRvJODRf+RVtDZ7udgbwvu77rmsyzY1FZXI+8yZ3s4kQ0+XF8v5+ctd42A77hzVjusUwM+aYcd3imBl3zIRuCcxMOGa+bvmYme+YzXVrjpnNHbOFbi0ws4VjttStJWa2dMwudOsCM7twzLQodyvMbOWm12SboTqwnhBWCVwKVwtmcs5QNZgrBzNpZ6ggzFWEmcwzf8KW08VKuJauKMwkn6GyMFcXZvLPUGWYKw0zEjBUHOaqw4wKDNWHuQKxFT0iVyNuNULF5K5G3AjBUTV5b77YCYOqyV2NuBGC43PL1YjTGnFXI26E4Kju3NWIGyE4Ohe5qxE3QnBUd+5qxI0QHNWduxpxIwRHdeeuRmJGjl24GgmrEVohwtVIWI1Q3UVvWbPrGqq7cDUStEbC1UgYIQRaIcLVSBghBFohwtVILOnorkbCCCHwpdrVSBghBFohwtXIpzXyXY18I4RAa8l3NfKNEAKtJb/SyO6bZgOW4XW1f+odsDmw7L2HelNl7Y6/9/SKtt6/TTy9DthfXrd1JVW/TXtZ/fr2/7du0zUtQ0V/uukTYfDTfth1sfQsaWPxJe37Yu7Vguo7DjDlgCmnvM1xKKk/c0FkASLPD/mWzUElsUepDkIA8loMEqJoLjMB8xlgTuWsPi6ZsCotu+MSYLAADKgEmDu1qLtzAyQAf0alwHxDDhLPQVy9UNGeaf21DFyXwHV1yLU6+fWrU4DqFIf8B45AcEFyrm6qVZo1F+YdwEXnT7lXd/W2WFUaNlf6HQQYO1XsT1Jl1YNCUCAIIPELAqHVeph8BnKgjzWEvw5tBO8nUK//XQKpYtPOVdhB+kHFiwOhB1FB2gU1yaJiuDYAtpyaYVGBFCggyqmA5kXwpX4u7FyBJxXR3KwOuYK6YFRhGE9EUZAeRpUlsvqBlZNTatRzQFdy88TTAYDsUpOwvXbf2Gt5wBkUMaOquH21AX4M+FHK2CvH0F5HguGCRYPTEc27o16v4+pR80/1sApQAMhBDP01qzb2cbNzBgx8wrl5EU7KXVQ9GoOxg6FT7vZ22wz98XWwzwJ/TpG3L7pg8M70BbOQcrdvrCpNzAts5wk2GWqPKe1tEbFugKwLSroKYOAKBi3Q2PpElEWZjPW+qg9D929v/wHH01JAIyAAAA=="; \ No newline at end of file diff --git a/docs/functions/addDataKeys.html b/docs/functions/addDataKeys.html new file mode 100644 index 0000000..d853a37 --- /dev/null +++ b/docs/functions/addDataKeys.html @@ -0,0 +1,7 @@ +addDataKeys | Helping Hand - v0.1.0

Function addDataKeys

  • Joins additional data to the provided data set

    +
    import { remapData } from 'helping_hand'
    const remappedData = remapData(...); +
    +

    Parameters

    • data: {}[]
    • additionalData: {}

      Returns {}[]

      Example

      This will remap the name key to firstname

      +
      const data = [
      {
      name: 'Jason'
      }
      ]
      const dataMap = {
      firstname: 'name'
      }

      const remappedData = remapData(data, dataMap); +
      +
    \ No newline at end of file diff --git a/docs/functions/addValueArray.html b/docs/functions/addValueArray.html index deba299..e17e857 100644 --- a/docs/functions/addValueArray.html +++ b/docs/functions/addValueArray.html @@ -1,4 +1,4 @@ -addValueArray | helping_hand

    Function addValueArray

    • Add immutable values to an array

      +addValueArray | Helping Hand - v0.1.0

      Function addValueArray

      • Add immutable values to an array

        import { addValueArray } from 'helping_hand'
        const newArray = addValueArray(...);
        -

        Parameters

        • arr: {}[]
        • value: {}

          Returns {}[]

        \ No newline at end of file +

        Parameters

        • arr: {}[]
        • value: {}

          Returns {}[]

        \ No newline at end of file diff --git a/docs/functions/allSettled.html b/docs/functions/allSettled.html index a6818af..2af8a9b 100644 --- a/docs/functions/allSettled.html +++ b/docs/functions/allSettled.html @@ -1,2 +1,2 @@ -allSettled | helping_hand

        Function allSettled

        • Parameters

          • promises: any[]

          Returns Promise<any[]>

          Deprecated

          Use native promises instead

          -
        \ No newline at end of file +allSettled | Helping Hand - v0.1.0

        Function allSettled

        • Parameters

          • promises: any[]

          Returns Promise<any[]>

          Deprecated

          Use native promises instead

          +
        \ No newline at end of file diff --git a/docs/functions/deepImmutable.html b/docs/functions/deepImmutable.html index 8a8c895..3d7298a 100644 --- a/docs/functions/deepImmutable.html +++ b/docs/functions/deepImmutable.html @@ -1,4 +1,4 @@ -deepImmutable | helping_hand

        Function deepImmutable

        • Create a deep immutable object

          +deepImmutable | Helping Hand - v0.1.0

          Function deepImmutable

          • Create a deep immutable object

            import { deepImmutable } from 'helping_hand'
            const newDeep = deepImmutable(...);
            -

            Parameters

            • arr: {}[]
            • objOnly: boolean

            Returns {}[]

          \ No newline at end of file +

          Parameters

          • arr: {}[]
          • objOnly: boolean

          Returns {}[]

        \ No newline at end of file diff --git a/docs/functions/diffArray.html b/docs/functions/diffArray.html new file mode 100644 index 0000000..d9bf303 --- /dev/null +++ b/docs/functions/diffArray.html @@ -0,0 +1,4 @@ +diffArray | Helping Hand - v0.1.0

        Function diffArray

        • Get the difference from 2 array of objects

          +
          import { diffArray } from 'helping_hand'
          const newDiffArray = diffArray(...); +
          +

          Parameters

          Returns {}[]

        \ No newline at end of file diff --git a/docs/functions/diffObject.html b/docs/functions/diffObject.html new file mode 100644 index 0000000..59954a2 --- /dev/null +++ b/docs/functions/diffObject.html @@ -0,0 +1,4 @@ +diffObject | Helping Hand - v0.1.0

        Function diffObject

        • Get the difference from 2 objects

          +
          import { diffObject } from 'helping_hand'
          const newDiffObject = diffObject(...); +
          +

          Parameters

          Returns {}

          \ No newline at end of file diff --git a/docs/functions/dollarsToPennies.html b/docs/functions/dollarsToPennies.html index 41e4e10..458d3cc 100644 --- a/docs/functions/dollarsToPennies.html +++ b/docs/functions/dollarsToPennies.html @@ -1,4 +1,4 @@ -dollarsToPennies | helping_hand

          Function dollarsToPennies

          • Convert dollars to pennies

            +dollarsToPennies | Helping Hand - v0.1.0

            Function dollarsToPennies

            • Convert dollars to pennies

              import { dollarsToPennies } from 'helping_hand'
              const pennies = dollarsToPennies(...);
              -

              Parameters

              • amount: string

              Returns number

            \ No newline at end of file +

            Parameters

            • amount: string

            Returns number

          \ No newline at end of file diff --git a/docs/functions/formatValueToDecimal.html b/docs/functions/formatValueToDecimal.html index 64b677b..c732cab 100644 --- a/docs/functions/formatValueToDecimal.html +++ b/docs/functions/formatValueToDecimal.html @@ -1,4 +1,4 @@ -formatValueToDecimal | helping_hand

          Function formatValueToDecimal

          • Format a value to a decimal string

            +formatValueToDecimal | Helping Hand - v0.1.0

            Function formatValueToDecimal

            • Format a value to a decimal string

              import { formatValueToDecimal } from 'helping_hand'
              const decimal = formatValueToDecimal(...);
              -

              Parameters

              • val: number

              Returns string

            \ No newline at end of file +

            Parameters

            • val: number

            Returns string

          \ No newline at end of file diff --git a/docs/functions/getPercentAsDecimal.html b/docs/functions/getPercentAsDecimal.html index 077f5cd..cf88f94 100644 --- a/docs/functions/getPercentAsDecimal.html +++ b/docs/functions/getPercentAsDecimal.html @@ -1,4 +1,4 @@ -getPercentAsDecimal | helping_hand

          Function getPercentAsDecimal

          • Convert a percentage to a decimal format

            +getPercentAsDecimal | Helping Hand - v0.1.0

            Function getPercentAsDecimal

            • Convert a percentage to a decimal format

              import { getPercentAsDecimal } from 'helping_hand'
              const decimal = getPercentAsDecimal(...);
              -

              Parameters

              • percent: number
              • val: number

              Returns number

            \ No newline at end of file +

            Parameters

            • percent: number
            • val: number

            Returns number

          \ No newline at end of file diff --git a/docs/functions/immutableObject.html b/docs/functions/immutableObject.html index 543a362..6e1048b 100644 --- a/docs/functions/immutableObject.html +++ b/docs/functions/immutableObject.html @@ -1,4 +1,4 @@ -immutableObject | helping_hand

          Function immutableObject

          • Create an immutable object of 1 level deep

            +immutableObject | Helping Hand - v0.1.0

            Function immutableObject

            • Create an immutable object of 1 level deep

              import { immutableObject } from 'helping_hand'
              const newObject = immutableObject(...);
              -

              Parameters

              • obj: {}

                Returns {}

                \ No newline at end of file +

                Parameters

                • obj: {}

                  Returns {}

                  \ No newline at end of file diff --git a/docs/functions/isArray.html b/docs/functions/isArray.html new file mode 100644 index 0000000..308d0e1 --- /dev/null +++ b/docs/functions/isArray.html @@ -0,0 +1,4 @@ +isArray | Helping Hand - v0.1.0

                  Function isArray

                  • Checks value for array type

                    +
                    import { isArray } from 'helping_hand'
                    const isTrue = isArray(...); +
                    +

                    Parameters

                    • val: any

                    Returns boolean

                  \ No newline at end of file diff --git a/docs/functions/isObject.html b/docs/functions/isObject.html index 34f4667..cbe7964 100644 --- a/docs/functions/isObject.html +++ b/docs/functions/isObject.html @@ -1,4 +1,4 @@ -isObject | helping_hand

                  Function isObject

                  • Checks value for object type

                    +isObject | Helping Hand - v0.1.0

                    Function isObject

                    • Checks value for object type

                      import { isObject } from 'helping_hand'
                      const isTrue = isObject(...);
                      -

                      Parameters

                      • val: any

                      Returns boolean

                    \ No newline at end of file +

                    Parameters

                    • val: any

                    Returns boolean

                  \ No newline at end of file diff --git a/docs/functions/joinValues.html b/docs/functions/joinValues.html index 53cb509..8bd6b80 100644 --- a/docs/functions/joinValues.html +++ b/docs/functions/joinValues.html @@ -1,4 +1,4 @@ -joinValues | helping_hand

                  Function joinValues

                  • Join values together when next is truthy

                    +joinValues | Helping Hand - v0.1.0

                    Function joinValues

                    • Join values together when next is truthy

                      import { joinValues } from 'helping_hand'
                      const joined = joinValues(...);
                      -

                      Parameters

                      • prev: string
                      • next: string

                      Returns string

                    \ No newline at end of file +

                    Parameters

                    • prev: string
                    • next: string

                    Returns string

                  \ No newline at end of file diff --git a/docs/functions/loopArray.html b/docs/functions/loopArray.html index 4884f7b..354281d 100644 --- a/docs/functions/loopArray.html +++ b/docs/functions/loopArray.html @@ -1,4 +1,4 @@ -loopArray | helping_hand

                  Function loopArray

                  • Loops through an array checking for types, creating a new array

                    +loopArray | Helping Hand - v0.1.0

                    Function loopArray

                    • Loops through an array checking for types, creating a new array

                      import { loopArray } from 'helping_hand'
                      const looped = loopArray(...);
                      -

                      Parameters

                      • arr: any[]

                      Returns any[]

                    \ No newline at end of file +

                    Parameters

                    • arr: any[]

                    Returns any[]

                  \ No newline at end of file diff --git a/docs/functions/loopObject.html b/docs/functions/loopObject.html index 507d82e..9ff37e4 100644 --- a/docs/functions/loopObject.html +++ b/docs/functions/loopObject.html @@ -1,4 +1,4 @@ -loopObject | helping_hand

                  Function loopObject

                  • Loops through an object checking for types, creating a new object

                    +loopObject | Helping Hand - v0.1.0

                    Function loopObject

                    • Loops through an object checking for types, creating a new object

                      import { loopObject } from 'helping_hand'
                      const looped = loopObject(...);
                      -

                      Parameters

                      • obj: {}

                        Returns {}

                        \ No newline at end of file +

                        Parameters

                        • obj: {}

                          Returns {}

                          \ No newline at end of file diff --git a/docs/functions/penniesToDollars.html b/docs/functions/penniesToDollars.html index ef5f6b1..77789f9 100644 --- a/docs/functions/penniesToDollars.html +++ b/docs/functions/penniesToDollars.html @@ -1,4 +1,4 @@ -penniesToDollars | helping_hand

                          Function penniesToDollars

                          • Convert pennies to dollars

                            +penniesToDollars | Helping Hand - v0.1.0

                            Function penniesToDollars

                            • Convert pennies to dollars

                              import { penniesToDollars } from 'helping_hand'
                              const dollars = penniesToDollars(...);
                              -

                              Parameters

                              • amount: number

                              Returns string

                            \ No newline at end of file +

                            Parameters

                            • amount: number

                            Returns string

                          \ No newline at end of file diff --git a/docs/functions/recursiveCopy.html b/docs/functions/recursiveCopy.html index bc93210..014b9f0 100644 --- a/docs/functions/recursiveCopy.html +++ b/docs/functions/recursiveCopy.html @@ -1,4 +1,4 @@ -recursiveCopy | helping_hand

                          Function recursiveCopy

                          • Copy and array of objects recursively

                            +recursiveCopy | Helping Hand - v0.1.0

                            Function recursiveCopy

                            • Copy and array of objects recursively

                              import { recursiveCopy } from 'helping_hand'
                              const copy = recursiveCopy(...);
                              -

                              Parameters

                              • arr: {}[]

                              Returns {}[]

                            \ No newline at end of file +

                            Parameters

                            • arr: {}[]

                            Returns {}[]

                          \ No newline at end of file diff --git a/docs/functions/reflect.html b/docs/functions/reflect.html index a666eaa..fb3ca60 100644 --- a/docs/functions/reflect.html +++ b/docs/functions/reflect.html @@ -1,2 +1,2 @@ -reflect | helping_hand

                          Function reflect

                          • Parameters

                            • p: any

                            Returns any

                            Deprecated

                            Use native promises instead

                            -
                          \ No newline at end of file +reflect | Helping Hand - v0.1.0

                          Function reflect

                          • Parameters

                            • p: any

                            Returns any

                            Deprecated

                            Use native promises instead

                            +
                          \ No newline at end of file diff --git a/docs/functions/remapData.html b/docs/functions/remapData.html new file mode 100644 index 0000000..9f78550 --- /dev/null +++ b/docs/functions/remapData.html @@ -0,0 +1,7 @@ +remapData | Helping Hand - v0.1.0

                          Function remapData

                          • Remap an arrays object keys

                            +
                            import { remapData } from 'helping_hand'
                            const remappedData = remapData(...); +
                            +

                            Parameters

                            • data: {}[]
                            • dataMap: {}

                              Returns {}[]

                              Example

                              This will remap the name key to firstname

                              +
                              const data = [
                              {
                              name: 'Jason'
                              }
                              ]
                              const dataMap = {
                              firstname: 'name'
                              }

                              const remappedData = remapData(data, dataMap); +
                              +
                            \ No newline at end of file diff --git a/docs/functions/removeAllLeadingZeros.html b/docs/functions/removeAllLeadingZeros.html index 2730d66..e04947a 100644 --- a/docs/functions/removeAllLeadingZeros.html +++ b/docs/functions/removeAllLeadingZeros.html @@ -1,4 +1,4 @@ -removeAllLeadingZeros | helping_hand

                            Function removeAllLeadingZeros

                            • Remove all leading zeros from an input

                              +removeAllLeadingZeros | Helping Hand - v0.1.0

                              Function removeAllLeadingZeros

                              • Remove all leading zeros from an input

                                import { removeAllLeadingZeros } from 'helping_hand'
                                const removed = removeAllLeadingZeros(...);
                                -

                                Parameters

                                • val: string

                                Returns string

                              \ No newline at end of file +

                              Parameters

                              • val: string

                              Returns string

                            \ No newline at end of file diff --git a/docs/functions/removeLastChar.html b/docs/functions/removeLastChar.html index 7019c2c..2785114 100644 --- a/docs/functions/removeLastChar.html +++ b/docs/functions/removeLastChar.html @@ -1,4 +1,4 @@ -removeLastChar | helping_hand

                            Function removeLastChar

                            • Remove the last character from the string

                              +removeLastChar | Helping Hand - v0.1.0

                              Function removeLastChar

                              • Remove the last character from the string

                                import { removeLastChar } from 'helping_hand'
                                const removed = removeLastChar(...);
                                -

                                Parameters

                                • val: string

                                Returns string

                              \ No newline at end of file +

                              Parameters

                              • val: string

                              Returns string

                            \ No newline at end of file diff --git a/docs/functions/sanitizeNumInput.html b/docs/functions/sanitizeNumInput.html index 254107c..8a2f079 100644 --- a/docs/functions/sanitizeNumInput.html +++ b/docs/functions/sanitizeNumInput.html @@ -1,4 +1,4 @@ -sanitizeNumInput | helping_hand

                            Function sanitizeNumInput

                            • Sanitize a number input, removing .

                              +sanitizeNumInput | Helping Hand - v0.1.0

                              Function sanitizeNumInput

                              • Sanitize a number input, removing .

                                import { sanitizeNumInput } from 'helping_hand'
                                const sanitized = sanitizeNumInput(...);
                                -

                                Parameters

                                • val: string

                                Returns string

                              \ No newline at end of file +

                              Parameters

                              • val: string

                              Returns string

                            \ No newline at end of file diff --git a/docs/functions/searchDataByKeys.html b/docs/functions/searchDataByKeys.html index 5b0d0e2..f5a36ba 100644 --- a/docs/functions/searchDataByKeys.html +++ b/docs/functions/searchDataByKeys.html @@ -1,5 +1,5 @@ -searchDataByKeys | helping_hand

                            Function searchDataByKeys

                            • Search data by term and keys, allowing for full nested checks

                              +searchDataByKeys | Helping Hand - v0.1.0

                              Function searchDataByKeys

                              • Search data by term and keys, allowing for full nested checks

                                Parameters

                                • data: {}[] = []
                                • searchTerm: string = ''
                                • keys: string[] = []
                                • __namedParameters: Nested = {}

                                Returns {}[]

                                Default Value

                                Default searchs one notation level deep unless option is true

                                import { searchDataByKeys } from 'helping_hand'
                                const data = searchDataByKeys(...);
                                -
                              \ No newline at end of file +
                            \ No newline at end of file diff --git a/docs/functions/sliceLeadingZero.html b/docs/functions/sliceLeadingZero.html index 026e923..3240f67 100644 --- a/docs/functions/sliceLeadingZero.html +++ b/docs/functions/sliceLeadingZero.html @@ -1,4 +1,4 @@ -sliceLeadingZero | helping_hand

                            Function sliceLeadingZero

                            • Slice the leading 0 from the input

                              +sliceLeadingZero | Helping Hand - v0.1.0

                              Function sliceLeadingZero

                              • Slice the leading 0 from the input

                                import { sliceLeadingZero } from 'helping_hand'
                                const sliced = sliceLeadingZero(...);
                                -

                                Parameters

                                • val: string

                                Returns string

                              \ No newline at end of file +

                              Parameters

                              • val: string

                              Returns string

                            \ No newline at end of file diff --git a/docs/functions/stringToNum.html b/docs/functions/stringToNum.html index 59adc1d..c790c29 100644 --- a/docs/functions/stringToNum.html +++ b/docs/functions/stringToNum.html @@ -1,4 +1,4 @@ -stringToNum | helping_hand

                            Function stringToNum

                            • Convert a string to a number

                              +stringToNum | Helping Hand - v0.1.0

                              Function stringToNum

                              • Convert a string to a number

                                import { stringToNum } from 'helping_hand'
                                const num = stringToNum(...);
                                -

                                Parameters

                                • val: string

                                Returns number

                              \ No newline at end of file +

                              Parameters

                              • val: string

                              Returns number

                            \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 67ef557..a40c904 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,6 +1,7 @@ -helping_hand

                            helping_hand

                            Helping Hand

                            Build Status +Helping Hand - v0.1.0

                            Helping Hand - v0.1.0

                            Helping Hand

                            Node.js CI Coverage Status

                            Javascript utility library written in typescript.

                            +

                            Documentation Site

                            Documentation Site

                            Install

                            npm i helping_hand
                             
                            import { module } from 'helping_hand'
                            @@ -34,4 +35,7 @@
                             

                            Run tests coverage report

                            npm run test:coverage
                             
                            -
                            \ No newline at end of file +

                            Create typedocs

                            +
                            npm run typedoc
                            +
                            +
                            \ No newline at end of file diff --git a/docs/modules.html b/docs/modules.html index 9ba5894..12f6c56 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -1,10 +1,22 @@ -helping_hand

                            helping_hand

                            Index

                            Array Helper

                            addValueArray +Helping Hand - v0.1.0
                            \ No newline at end of file +
                            \ No newline at end of file diff --git a/docs/types/DiffOptionsType.html b/docs/types/DiffOptionsType.html new file mode 100644 index 0000000..0d99e05 --- /dev/null +++ b/docs/types/DiffOptionsType.html @@ -0,0 +1 @@ +DiffOptionsType | Helping Hand - v0.1.0

                            Type alias DiffOptionsType

                            DiffOptionsType: {
                                allowUndefinedNull?: boolean;
                                convertNullToUndefined?: boolean;
                            }

                            Type declaration

                            • Optional allowUndefinedNull?: boolean
                            • Optional convertNullToUndefined?: boolean
                            \ No newline at end of file diff --git a/docs/types/DiffType.html b/docs/types/DiffType.html new file mode 100644 index 0000000..57cdaf5 --- /dev/null +++ b/docs/types/DiffType.html @@ -0,0 +1 @@ +DiffType | Helping Hand - v0.1.0

                            Type alias DiffType

                            DiffType: any
                            \ No newline at end of file diff --git a/docs/types/IntArrayType.html b/docs/types/IntArrayType.html new file mode 100644 index 0000000..e89c81d --- /dev/null +++ b/docs/types/IntArrayType.html @@ -0,0 +1 @@ +IntArrayType | Helping Hand - v0.1.0

                            Type alias IntArrayType

                            IntArrayType: {
                                [key: string]: any;
                            }[]

                            Type declaration

                            • [key: string]: any
                            \ No newline at end of file diff --git a/docs/types/IntObjectType.html b/docs/types/IntObjectType.html new file mode 100644 index 0000000..059413e --- /dev/null +++ b/docs/types/IntObjectType.html @@ -0,0 +1 @@ +IntObjectType | Helping Hand - v0.1.0

                            Type alias IntObjectType

                            IntObjectType: {
                                [key: string]: any;
                            }

                            Type declaration

                            • [key: string]: any
                            \ No newline at end of file diff --git a/docs/types/IntType.html b/docs/types/IntType.html new file mode 100644 index 0000000..de03fea --- /dev/null +++ b/docs/types/IntType.html @@ -0,0 +1 @@ +IntType | Helping Hand - v0.1.0

                            Type alias IntType

                            IntType: {
                                [key: string | number]: any;
                            }[]

                            Type declaration

                            • [key: string | number]: any
                            \ No newline at end of file diff --git a/docs/types/Nested.html b/docs/types/Nested.html index ad43447..c9fa6ff 100644 --- a/docs/types/Nested.html +++ b/docs/types/Nested.html @@ -1 +1 @@ -Nested | helping_hand

                            Type alias Nested

                            Nested: {
                                allowNested?: boolean;
                            }

                            Type declaration

                            • Optional allowNested?: boolean
                            \ No newline at end of file +Nested | Helping Hand - v0.1.0

                            Type alias Nested

                            Nested: {
                                allowNested?: boolean;
                            }

                            Type declaration

                            • Optional allowNested?: boolean
                            \ No newline at end of file diff --git a/docs/types/UpdateObjectType.html b/docs/types/UpdateObjectType.html new file mode 100644 index 0000000..1a4f5ea --- /dev/null +++ b/docs/types/UpdateObjectType.html @@ -0,0 +1 @@ +UpdateObjectType | Helping Hand - v0.1.0

                            Type alias UpdateObjectType

                            UpdateObjectType: {
                                [key: string]: any;
                            }

                            Type declaration

                            • [key: string]: any
                            \ No newline at end of file diff --git a/docs/types/UpdateType.html b/docs/types/UpdateType.html new file mode 100644 index 0000000..43bc768 --- /dev/null +++ b/docs/types/UpdateType.html @@ -0,0 +1 @@ +UpdateType | Helping Hand - v0.1.0

                            Type alias UpdateType

                            UpdateType: {
                                [key: string]: any;
                            }[]

                            Type declaration

                            • [key: string]: any
                            \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c923c38..fa7f925 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "babel-polyfill": "^6.26.0", "babel-runtime": "^6.26.0", "coveralls": "^3.0.2", - "eslint": "^5.13.0", + "eslint": "^5.16.0", "eslint-config-prettier": "^4.0.0", "eslint-config-standard": "^12.0.0", "eslint-plugin-import": "^2.16.0", @@ -153,12 +153,15 @@ } }, "node_modules/@babel/helper-annotate-as-pure": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz", - "integrity": "sha512-3UYcJUj9kvSLbLbUIfQTqzcy5VX7GRZ/CCDrnOaZorFFM01aXp1+GJwuFGV4NDDoAS+mOUyHcO6UD/RfqOks3Q==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz", + "integrity": "sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg==", "dev": true, "dependencies": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { @@ -183,21 +186,37 @@ } }, "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.2.1.tgz", - "integrity": "sha512-EsEP7XLFmcJHjcuFYBxYD1FkP0irC8C9fsrt2tX/jrAi/eTnFI6DOPgVFb+WREeg1GboF+Ib+nCHbGBodyAXSg==", + "version": "7.24.4", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.24.4.tgz", + "integrity": "sha512-lG75yeuUSVu0pIcbhiYMXBXANHrpUPaOfu7ryAzskCgKUHuAxRQI5ssrtmF0X9UXldPlvT0XM/A4F44OXRt6iQ==", "dev": true, "dependencies": { - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-member-expression-to-functions": "^7.0.0", - "@babel/helper-optimise-call-expression": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-replace-supers": "^7.1.0" + "@babel/helper-annotate-as-pure": "^7.22.5", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-member-expression-to-functions": "^7.23.0", + "@babel/helper-optimise-call-expression": "^7.22.5", + "@babel/helper-replace-supers": "^7.24.1", + "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, + "node_modules/@babel/helper-create-class-features-plugin/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/@babel/helper-define-map": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.1.0.tgz", @@ -263,51 +282,68 @@ } }, "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.0.0.tgz", - "integrity": "sha512-avo+lm/QmZlv27Zsi0xEor2fKcqWG56D5ae9dzklpIaY7cQMK5N8VSpaNVPPagiqmy7LrEjK1IWdGMOqPu5csg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.23.0.tgz", + "integrity": "sha512-6gfrPwh7OuT6gZyJZvd6WbTfrqAo7vm4xCzAXOusKqq/vWdKXphTpj5klHKNmRUU6/QRGlBsyU9mAIPaWHlqJA==", "dev": true, "dependencies": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.23.0" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-imports": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz", - "integrity": "sha512-aP/hlLq01DWNEiDg4Jn23i+CXxW/owM4WpDLFUbpjxe4NS3BhLVZQ5i7E0ZrxuQ/vwekIeciyamgB1UIYxxM6A==", + "version": "7.24.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.3.tgz", + "integrity": "sha512-viKb0F9f2s0BCS22QSF308z/+1YWKV/76mwt61NBzS5izMzDPwdq1pTrzf+Li3npBWX9KdQbkeCt1jSAM7lZqg==", "dev": true, "dependencies": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.24.0" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.1.0.tgz", - "integrity": "sha512-0JZRd2yhawo79Rcm4w0LwSMILFmFXjugG3yqf+P/UsKsRS1mJCmMwwlHDlMg7Avr9LrvSpp4ZSULO9r8jpCzcw==", + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz", + "integrity": "sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==", "dev": true, "dependencies": { - "@babel/helper-module-imports": "^7.0.0", - "@babel/helper-simple-access": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.0.0", - "@babel/template": "^7.1.0", - "@babel/types": "^7.0.0", - "lodash": "^4.17.10" + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-module-imports": "^7.22.15", + "@babel/helper-simple-access": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/helper-validator-identifier": "^7.22.20" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz", - "integrity": "sha512-u8nd9NQePYNQV8iPWu/pLLYBqZBa4ZaY1YWRFMuxrid94wKI1QNt67NEZ7GAe5Kc/0LLScbim05xZFWkAdrj9g==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.22.5.tgz", + "integrity": "sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw==", "dev": true, "dependencies": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz", - "integrity": "sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA==", - "dev": true + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.0.tgz", + "integrity": "sha512-9cUznXMG0+FxRuJfvL82QlTqIzhVW9sL0KjMPHhAOOvpQGL8QtdxnBKILjBqxlHyliz0yCa1G903ZXI/FuHy2w==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } }, "node_modules/@babel/helper-regex": { "version": "7.0.0", @@ -332,25 +368,44 @@ } }, "node_modules/@babel/helper-replace-supers": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.1.0.tgz", - "integrity": "sha512-BvcDWYZRWVuDeXTYZWxekQNO5D4kO55aArwZOTFXw6rlLQA8ZaDicJR1sO47h+HrnCiDFiww0fSPV0d713KBGQ==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.24.1.tgz", + "integrity": "sha512-QCR1UqC9BzG5vZl8BMicmZ28RuUBnHhAMddD8yHFHDRH9lLTZ9uUPehX8ctVPT8l0TKblJidqcgUUKGVrePleQ==", "dev": true, "dependencies": { - "@babel/helper-member-expression-to-functions": "^7.0.0", - "@babel/helper-optimise-call-expression": "^7.0.0", - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-member-expression-to-functions": "^7.23.0", + "@babel/helper-optimise-call-expression": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, "node_modules/@babel/helper-simple-access": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz", - "integrity": "sha512-Vk+78hNjRbsiu49zAPALxTb+JUQCz1aolpd8osOF16BGnLtseD21nbHgLPGUwrXEurZgiCOUmvs3ExTu4F5x6w==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz", + "integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==", "dev": true, "dependencies": { - "@babel/template": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.22.5.tgz", + "integrity": "sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-split-export-declaration": { @@ -383,6 +438,15 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/helper-validator-option": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz", + "integrity": "sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/helper-wrap-function": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.2.0.tgz", @@ -546,6 +610,21 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.1.tgz", + "integrity": "sha512-2eCtxZXf+kbkMIsXS4poTvT4Yu5rXiRa+9xGVT56raghjmBTKMpFNc9R4IDiB4emao9eO22Ox7CxuJG7BgExqA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-syntax-object-rest-spread": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz", @@ -571,12 +650,15 @@ } }, "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.3.3.tgz", - "integrity": "sha512-dGwbSMA1YhVS8+31CnPR7LB4pcbrzcV99wQzby4uAfrkZPYZlQ7ImwdpzLqi6Z6IL02b8IAL379CaMwo0x5Lag==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.1.tgz", + "integrity": "sha512-Yhnmvy5HZEnHUty6i++gcfH1/l68AHnItFHnaCv6hn9dNh0hQvvQJsxpi4BMBFN5DLeHBuucT/0DgzXif/OyRw==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.24.0" + }, + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" @@ -769,14 +851,17 @@ } }, "node_modules/@babel/plugin-transform-modules-commonjs": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.2.0.tgz", - "integrity": "sha512-V6y0uaUQrQPXUrmj+hgnks8va2L0zcZymeU7TtWEgdRLNkceafKXEduv7QzgQAE4lT+suwooG9dC7LFhdRAbVQ==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.24.1.tgz", + "integrity": "sha512-szog8fFTUxBfw0b98gEWPaEqF42ZUD/T3bkynW/wtgx2p/XCP55WEsb+VosKceRSd6njipdZvNogqdtI4Q0chw==", "dev": true, "dependencies": { - "@babel/helper-module-transforms": "^7.1.0", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-simple-access": "^7.1.0" + "@babel/helper-module-transforms": "^7.23.3", + "@babel/helper-plugin-utils": "^7.24.0", + "@babel/helper-simple-access": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" @@ -922,13 +1007,18 @@ } }, "node_modules/@babel/plugin-transform-typescript": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.3.2.tgz", - "integrity": "sha512-Pvco0x0ZSCnexJnshMfaibQ5hnK8aUHSvjCQhC1JR8eeg+iBwt0AtCO7gWxJ358zZevuf9wPSO5rv+WJcbHPXQ==", + "version": "7.24.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.24.4.tgz", + "integrity": "sha512-79t3CQ8+oBGk/80SQ8MN3Bs3obf83zJ0YZjDmDaEZN8MqhMI760apl5z6a20kFeMXBwJX99VpKT8CKxEBp5H1g==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-typescript": "^7.2.0" + "@babel/helper-annotate-as-pure": "^7.22.5", + "@babel/helper-create-class-features-plugin": "^7.24.4", + "@babel/helper-plugin-utils": "^7.24.0", + "@babel/plugin-syntax-typescript": "^7.24.1" + }, + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" @@ -1018,13 +1108,19 @@ } }, "node_modules/@babel/preset-typescript": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.3.3.tgz", - "integrity": "sha512-mzMVuIP4lqtn4du2ynEfdO0+RYcslwrZiJHXu4MGaC1ctJiW2fyaeDrtjJGs7R/KebZ1sgowcIoWf4uRpEfKEg==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.24.1.tgz", + "integrity": "sha512-1DBaMmRDpuYQBPWD8Pf/WEwCrtgRHxsZnP4mIy9G/X+hFfbI47Q2G4t1Paakld84+qsk2fSsUPMKg71jkoOOaQ==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-transform-typescript": "^7.3.2" + "@babel/helper-plugin-utils": "^7.24.0", + "@babel/helper-validator-option": "^7.23.5", + "@babel/plugin-syntax-jsx": "^7.24.1", + "@babel/plugin-transform-modules-commonjs": "^7.24.1", + "@babel/plugin-transform-typescript": "^7.24.1" + }, + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" @@ -1527,12 +1623,12 @@ } }, "node_modules/acorn-jsx": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.1.tgz", - "integrity": "sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, "peerDependencies": { - "acorn": "^6.0.0" + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "node_modules/acorn-walk": { @@ -2285,13 +2381,6 @@ "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", "dev": true }, - "node_modules/circular-json": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", - "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", - "deprecated": "CircularJSON is in maintenance only, flatted is its successor.", - "dev": true - }, "node_modules/class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", @@ -2659,15 +2748,15 @@ } }, "node_modules/doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", "dev": true, "dependencies": { "esutils": "^2.0.2" }, "engines": { - "node": ">=0.10.0" + "node": ">=6.0.0" } }, "node_modules/domexception": { @@ -2802,35 +2891,35 @@ } }, "node_modules/eslint": { - "version": "5.13.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.13.0.tgz", - "integrity": "sha512-nqD5WQMisciZC5EHZowejLKQjWGuFS5c70fxqSKlnDME+oz9zmE8KTlX+lHSg+/5wsC/kf9Q9eMkC8qS3oM2fg==", + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.16.0.tgz", + "integrity": "sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==", "dev": true, "dependencies": { "@babel/code-frame": "^7.0.0", - "ajv": "^6.5.3", + "ajv": "^6.9.1", "chalk": "^2.1.0", "cross-spawn": "^6.0.5", "debug": "^4.0.1", - "doctrine": "^2.1.0", - "eslint-scope": "^4.0.0", + "doctrine": "^3.0.0", + "eslint-scope": "^4.0.3", "eslint-utils": "^1.3.1", "eslint-visitor-keys": "^1.0.0", - "espree": "^5.0.0", + "espree": "^5.0.1", "esquery": "^1.0.1", "esutils": "^2.0.2", - "file-entry-cache": "^2.0.0", + "file-entry-cache": "^5.0.1", "functional-red-black-tree": "^1.0.1", "glob": "^7.1.2", "globals": "^11.7.0", "ignore": "^4.0.6", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", - "inquirer": "^6.1.0", - "js-yaml": "^3.12.0", + "inquirer": "^6.2.2", + "js-yaml": "^3.13.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.3.0", - "lodash": "^4.17.5", + "lodash": "^4.17.11", "minimatch": "^3.0.4", "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", @@ -2841,7 +2930,7 @@ "semver": "^5.5.1", "strip-ansi": "^4.0.0", "strip-json-comments": "^2.0.1", - "table": "^5.0.2", + "table": "^5.2.3", "text-table": "^0.2.0" }, "bin": { @@ -3231,9 +3320,9 @@ } }, "node_modules/eslint-scope": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", - "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", + "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==", "dev": true, "dependencies": { "esrecurse": "^4.1.0", @@ -3309,12 +3398,12 @@ } }, "node_modules/espree": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-5.0.0.tgz", - "integrity": "sha512-1MpUfwsdS9MMoN7ZXqAr9e9UKdVHDcvrJpyx7mm1WuQlx/ygErEQBzgi5Nh5qBHIoYweprhtMkTCb9GhcAIcsA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-5.0.1.tgz", + "integrity": "sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A==", "dev": true, "dependencies": { - "acorn": "^6.0.2", + "acorn": "^6.0.7", "acorn-jsx": "^5.0.0", "eslint-visitor-keys": "^1.0.0" }, @@ -3643,16 +3732,15 @@ } }, "node_modules/file-entry-cache": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", - "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", "dev": true, "dependencies": { - "flat-cache": "^1.2.1", - "object-assign": "^4.0.1" + "flat-cache": "^2.0.1" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, "node_modules/file-uri-to-path": { @@ -3702,20 +3790,25 @@ } }, "node_modules/flat-cache": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.4.tgz", - "integrity": "sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", "dev": true, "dependencies": { - "circular-json": "^0.3.1", - "graceful-fs": "^4.1.2", - "rimraf": "~2.6.2", - "write": "^0.2.1" + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, + "node_modules/flatted": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", + "dev": true + }, "node_modules/for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -5794,15 +5887,6 @@ "node": "*" } }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/object-copy": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", @@ -7990,15 +8074,15 @@ "dev": true }, "node_modules/write": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", - "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", "dev": true, "dependencies": { "mkdirp": "^0.5.1" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, "node_modules/write-file-atomic": { diff --git a/package.json b/package.json index 97fc5c2..4ddcfeb 100644 --- a/package.json +++ b/package.json @@ -31,13 +31,13 @@ "@babel/plugin-proposal-object-rest-spread": "^7.2.0", "@babel/polyfill": "^7.2.5", "@babel/preset-env": "^7.2.0", - "@babel/preset-typescript": "^7.3.3", + "@babel/preset-typescript": "^7.24.1", "babel-eslint": "^10.0.1", "babel-jest": "^24.1.0", "babel-polyfill": "^6.26.0", "babel-runtime": "^6.26.0", "coveralls": "^3.0.2", - "eslint": "^5.13.0", + "eslint": "^5.16.0", "eslint-config-prettier": "^4.0.0", "eslint-config-standard": "^12.0.0", "eslint-plugin-import": "^2.16.0", diff --git a/src/__tests__/diffUtils.test.js b/src/__tests__/diffUtils.test.js new file mode 100644 index 0000000..21e6940 --- /dev/null +++ b/src/__tests__/diffUtils.test.js @@ -0,0 +1,192 @@ +import { + diffArray, + diffObject, +} from '../diffUtils' + +describe('diff()', () => { + it('should diff two array datasets, ex 1', () => { + const M1 = [ + { + name: 'Jason', + age: 39, + title: 'Engineer', + check: 1, + empty: 'Nope', + data: { + worker: true, + daysAvailable: 1 + }, + arr: [ + { + name: 'Marc' + } + ], + unCheck: 'Remove this' + } + ] + + const M2 = [ + { + name: 'Jason', + age: 40, + title: 'Hello', + check: 0, + empty: 'Nope', + data: { + worker: true, + daysAvailable: 0 + }, + arr: [ + { + name: 'Mike' + } + ], + unCheck: null + } + ] + + const final = [ + { + age: 40, + title: 'Hello', + check: 0, + data: { + daysAvailable: 0 + }, + arr: [ + { + name: 'Mike' + } + ], + unCheck: null + } + ] + + const res = diffArray(M1, M2, { allowUndefinedNull: true }) + expect(res).toEqual(final) + }) + + it('should diff two array datasets, handle null to undefined', () => { + const M1 = [ + { + name: 'Jason', + age: 39, + title: 'Engineer', + check: 1, + empty: 'Nope', + data: { + worker: true, + daysAvailable: 1 + }, + arr: [ + { + name: 'Marc' + } + ], + unCheck: 'Remove this', + nullConvert: 'Convert this' + } + ] + + const M2 = [ + { + name: 'Jason', + age: 40, + title: 'Hello', + check: 0, + empty: 'Nope', + data: { + worker: true, + daysAvailable: 0 + }, + arr: [ + { + name: 'Mike' + } + ], + unCheck: undefined, + nullConvert: null + } + ] + + const final = [ + { + age: 40, + title: 'Hello', + check: 0, + data: { + daysAvailable: 0 + }, + arr: [ + { + name: 'Mike' + } + ], + unCheck: undefined, + nullConvert: undefined + } + ] + + const res = diffArray(M1, M2, { allowUndefinedNull: true, convertNullToUndefined: true }) + expect(res).toEqual(final) + }) + + it('should diff two object datasets', () => { + const M1 = { + name: 'Jason', + age: 39, + title: 'Engineer', + check: 1, + empty: 'Nope', + data: { + worker: true, + daysAvailable: 1 + }, + arr: [ + { + name: 'Marc' + } + ], + unCheck: 'Remove this', + nullConvert: 'Convert this' + } + + const M2 = { + name: 'Jason', + age: 40, + title: 'Hello', + check: 0, + empty: 'Nope', + data: { + worker: true, + daysAvailable: 0 + }, + arr: [ + { + name: 'Mike' + } + ], + unCheck: undefined, + nullConvert: null + } + + const final = { + age: 40, + title: 'Hello', + check: 0, + data: { + daysAvailable: 0 + }, + arr: [ + { + name: 'Mike' + } + ], + unCheck: undefined, + nullConvert: undefined + } + + const res = diffObject(M1, M2, { allowUndefinedNull: true, convertNullToUndefined: true }) + expect(res).toEqual(final) + }) +}) diff --git a/src/__tests__/functionUtils.test.js b/src/__tests__/functionUtils.test.js new file mode 100644 index 0000000..1a9d62b --- /dev/null +++ b/src/__tests__/functionUtils.test.js @@ -0,0 +1,52 @@ +import { + remapData, +} from '../functionUtils' + +describe('remapData()', () => { + it('should return data remapped to the new structure, ex 1', () => { + const data = [{ + name: 'Jason' + }, { + name: 'Trevor' + }] + + const remap = { + firstname: 'name' + } + + const result = [{ + firstname: 'Jason' + }, { + firstname: 'Trevor' + }] + + const res = remapData(data, remap) + expect(res).toEqual(result) + }) + + it('should return data remapped to the new structure, ex 2', () => { + const data = [{ + name: 'Jason', + address: '11111' + }, { + name: 'Trevor', + address: '22222' + }] + + const remap = { + firstname: 'name', + location: 'address' + } + + const result = [{ + firstname: 'Jason', + location: '11111' + }, { + firstname: 'Trevor', + location: '22222' + }] + + const res = remapData(data, remap) + expect(res).toEqual(result) + }) +}) diff --git a/src/arrayHelper.ts b/src/arrayHelper.ts index e3d4fb5..9235a64 100644 --- a/src/arrayHelper.ts +++ b/src/arrayHelper.ts @@ -77,8 +77,7 @@ export function loopArray (arr: any[]): any[] { let newVal for (let i = 0; i < len; i++) { - - if (Array.isArray(arr[i])) { + if (isArray(arr[i])) { newVal = loopArray(arr[i]) newArr.push(newVal) } else if (isObject(arr[i])) { @@ -105,7 +104,7 @@ export function loopObject (obj: {}): {} { const newObj: any = {} for (const key in obj) { - if (Array.isArray(obj[key])) { + if (isArray(obj[key])) { newObj[key] = loopArray(obj[key]) } else if (isObject(obj[key])) { newObj[key] = loopObject(obj[key]) @@ -117,6 +116,19 @@ export function loopObject (obj: {}): {} { return newObj } +/** + * Checks value for array type + * + * ```ts + * import { isArray } from 'helping_hand' + * const isTrue = isArray(...); + * ``` + * @category Array Helper + */ +export function isArray (val: any): boolean { + return Array.isArray(val) && val !== null +} + /** * Checks value for object type * diff --git a/src/diffUtils.ts b/src/diffUtils.ts new file mode 100644 index 0000000..4b7214d --- /dev/null +++ b/src/diffUtils.ts @@ -0,0 +1,125 @@ +import { isArray, isObject } from "./arrayHelper" + +/** + * @category Diff Utility + */ +export type IntType = { [key: string | number]: any }[] +/** + * @category Diff Utility + */ +export type IntArrayType = { [key: string]: any }[] +/** + * @category Diff Utility + */ +export type IntObjectType = { [key: string]: any } +/** + * @category Diff Utility + */ +export type UpdateType = { [key: string]: any }[] +/** + * @category Diff Utility + */ +export type UpdateObjectType = { [key: string]: any } +/** + * @category Diff Utility + */ +export type DiffType = any +/** + * @category Diff Utility + */ +export type DiffOptionsType = { + allowUndefinedNull?: boolean, + convertNullToUndefined?: boolean +} + +/** + * Get the difference from 2 array of objects + * + * ```ts + * import { diffArray } from 'helping_hand' + * const newDiffArray = diffArray(...); + * ``` + * @category Diff Utility + */ +export function diffArray (int: IntType, update: UpdateType, options: DiffOptionsType = {}) { + const ilen = int.length + const theDiff: {}[] = [] + + for (let i = 0; i < ilen; i++) { + if (update[i] != null) { + theDiff.push({}) + for(const key in int[i]) { + _diffInnerCheck(int[i][key], update[i][key], theDiff[i], key, options) + } + } + } + + return theDiff +} + +/** + * Get the difference from 2 objects + * + * ```ts + * import { diffObject } from 'helping_hand' + * const newDiffObject = diffObject(...); + * ``` + * @category Diff Utility + */ +export function diffObject (int: {}, update: {}, options: DiffOptionsType = {}) { + const theDiff: {} = {} + + if (update != null) { + for(const key in int) { + _diffInnerCheck(int[key], update[key], theDiff, key, options) + } + } + + return theDiff +} + +function _diffInnerArray (int: IntArrayType, update: UpdateType, diffVal: DiffType) { + const ilen = int.length + for (let i = 0; i < ilen; i++) { + if (update[i] != null) { + diffVal.push({}) + for(const key in int[i]) { + _diffInnerCheck(int[i][key], update[i][key], diffVal[i], key) + } + } + } +} + +function _diffInnerObject (int: IntObjectType, update: UpdateObjectType, diffVal: DiffType) { + for(const key in int) { + _diffInnerCheck(int[key], update[key], diffVal, key) + } +} + +function _diffInnerCheck (int: IntType, update: UpdateType, diffVal: DiffType, key: string, options: DiffOptionsType = {}) { + if (update != null) { + if (int !== update) { + if (isArray(update)) { + diffVal[key] = [] + _diffInnerArray(int, update, diffVal[key]) + } else if (isObject(update)) { + diffVal[key] = {} + _diffInnerObject(int, update, diffVal[key]) + } else { + diffVal[key] = update + } + } + } + if (options?.allowUndefinedNull && update == null) { + diffVal[key] = options?.convertNullToUndefined ? undefined : update + } +} + +interface LengthOfArg { + length: number; +} + +function logLength(arg: Type): Type { + console.log(arg.length); + return arg; +} \ No newline at end of file diff --git a/src/functionUtils.ts b/src/functionUtils.ts new file mode 100644 index 0000000..33bc353 --- /dev/null +++ b/src/functionUtils.ts @@ -0,0 +1,66 @@ +/** + * Remap an arrays object keys + * + * ```ts + * import { remapData } from 'helping_hand' + * const remappedData = remapData(...); + * ``` + * @category Data Utility + * + * @example + * This will remap the name key to firstname + * ```ts + * const data = [ + * { + * name: 'Jason' + * } + * ] + * const dataMap = { + * firstname: 'name' + * } + * + * const remappedData = remapData(data, dataMap); + * ``` + * + */ +export function remapData (data: {}[], dataMap: {}): {}[] { + return data.map(d => { + const mapped = {} + for (const key in dataMap) { + mapped[key] = d[dataMap[key]] + } + return mapped + }) +} + +/** + * Joins additional data to the provided data set + * + * ```ts + * import { remapData } from 'helping_hand' + * const remappedData = remapData(...); + * ``` + * @category Data Utility + * + * @example + * This will remap the name key to firstname + * ```ts + * const data = [ + * { + * name: 'Jason' + * } + * ] + * const dataMap = { + * firstname: 'name' + * } + * + * const remappedData = remapData(data, dataMap); + * ``` + * + */ +export function addDataKeys (data: {}[], additionalData: {}): {}[] { + return data.map(d => { + const mapped = { ...d, ...additionalData } + return mapped + }) +} diff --git a/src/index.ts b/src/index.ts index 65db75e..3d649b3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,3 +2,5 @@ export * from './valueHelper' export * from './promiseHelper' export * from './arrayHelper' export * from './searchUtils' +export * from './functionUtils' +export * from './diffUtils' diff --git a/tsconfig.json b/tsconfig.json index 3c6b6aa..a4641e6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compileOnSave": false, "compilerOptions": { - "target": "es2015", + "target": "es2020", "module": "commonjs", "outDir": "lib", "strict": true, diff --git a/typedoc.json b/typedoc.json index c6db2d9..382e7e1 100644 --- a/typedoc.json +++ b/typedoc.json @@ -2,5 +2,6 @@ "navigation": { "includeCategories": true }, - "version": true + "name": "Helping Hand", + "includeVersion": true } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index e1b1f41..476171b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -56,12 +56,12 @@ "@jridgewell/trace-mapping" "^0.3.25" jsesc "^2.5.1" -"@babel/helper-annotate-as-pure@^7.0.0": - version "7.0.0" - resolved "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz" - integrity sha512-3UYcJUj9kvSLbLbUIfQTqzcy5VX7GRZ/CCDrnOaZorFFM01aXp1+GJwuFGV4NDDoAS+mOUyHcO6UD/RfqOks3Q== +"@babel/helper-annotate-as-pure@^7.0.0", "@babel/helper-annotate-as-pure@^7.22.5": + version "7.22.5" + resolved "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz" + integrity sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.22.5" "@babel/helper-builder-binary-assignment-operator-visitor@^7.1.0": version "7.1.0" @@ -80,16 +80,20 @@ "@babel/traverse" "^7.1.0" "@babel/types" "^7.0.0" -"@babel/helper-create-class-features-plugin@^7.2.1": - version "7.2.1" - resolved "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.2.1.tgz" - integrity sha512-EsEP7XLFmcJHjcuFYBxYD1FkP0irC8C9fsrt2tX/jrAi/eTnFI6DOPgVFb+WREeg1GboF+Ib+nCHbGBodyAXSg== +"@babel/helper-create-class-features-plugin@^7.2.1", "@babel/helper-create-class-features-plugin@^7.24.4": + version "7.24.4" + resolved "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.24.4.tgz" + integrity sha512-lG75yeuUSVu0pIcbhiYMXBXANHrpUPaOfu7ryAzskCgKUHuAxRQI5ssrtmF0X9UXldPlvT0XM/A4F44OXRt6iQ== dependencies: - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-member-expression-to-functions" "^7.0.0" - "@babel/helper-optimise-call-expression" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.1.0" + "@babel/helper-annotate-as-pure" "^7.22.5" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-member-expression-to-functions" "^7.23.0" + "@babel/helper-optimise-call-expression" "^7.22.5" + "@babel/helper-replace-supers" "^7.24.1" + "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + semver "^6.3.1" "@babel/helper-define-map@^7.1.0": version "7.1.0" @@ -135,43 +139,42 @@ dependencies: "@babel/types" "^7.22.5" -"@babel/helper-member-expression-to-functions@^7.0.0": - version "7.0.0" - resolved "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.0.0.tgz" - integrity sha512-avo+lm/QmZlv27Zsi0xEor2fKcqWG56D5ae9dzklpIaY7cQMK5N8VSpaNVPPagiqmy7LrEjK1IWdGMOqPu5csg== +"@babel/helper-member-expression-to-functions@^7.23.0": + version "7.23.0" + resolved "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.23.0.tgz" + integrity sha512-6gfrPwh7OuT6gZyJZvd6WbTfrqAo7vm4xCzAXOusKqq/vWdKXphTpj5klHKNmRUU6/QRGlBsyU9mAIPaWHlqJA== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.23.0" -"@babel/helper-module-imports@^7.0.0": - version "7.0.0" - resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz" - integrity sha512-aP/hlLq01DWNEiDg4Jn23i+CXxW/owM4WpDLFUbpjxe4NS3BhLVZQ5i7E0ZrxuQ/vwekIeciyamgB1UIYxxM6A== +"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.22.15": + version "7.24.3" + resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.3.tgz" + integrity sha512-viKb0F9f2s0BCS22QSF308z/+1YWKV/76mwt61NBzS5izMzDPwdq1pTrzf+Li3npBWX9KdQbkeCt1jSAM7lZqg== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.24.0" -"@babel/helper-module-transforms@^7.1.0": - version "7.1.0" - resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.1.0.tgz" - integrity sha512-0JZRd2yhawo79Rcm4w0LwSMILFmFXjugG3yqf+P/UsKsRS1mJCmMwwlHDlMg7Avr9LrvSpp4ZSULO9r8jpCzcw== +"@babel/helper-module-transforms@^7.1.0", "@babel/helper-module-transforms@^7.23.3": + version "7.23.3" + resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz" + integrity sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ== dependencies: - "@babel/helper-module-imports" "^7.0.0" - "@babel/helper-simple-access" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.0.0" - "@babel/template" "^7.1.0" - "@babel/types" "^7.0.0" - lodash "^4.17.10" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-module-imports" "^7.22.15" + "@babel/helper-simple-access" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/helper-validator-identifier" "^7.22.20" -"@babel/helper-optimise-call-expression@^7.0.0": - version "7.0.0" - resolved "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz" - integrity sha512-u8nd9NQePYNQV8iPWu/pLLYBqZBa4ZaY1YWRFMuxrid94wKI1QNt67NEZ7GAe5Kc/0LLScbim05xZFWkAdrj9g== +"@babel/helper-optimise-call-expression@^7.0.0", "@babel/helper-optimise-call-expression@^7.22.5": + version "7.22.5" + resolved "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.22.5.tgz" + integrity sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.22.5" -"@babel/helper-plugin-utils@^7.0.0": - version "7.0.0" - resolved "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz" - integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA== +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.24.0": + version "7.24.0" + resolved "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.0.tgz" + integrity sha512-9cUznXMG0+FxRuJfvL82QlTqIzhVW9sL0KjMPHhAOOvpQGL8QtdxnBKILjBqxlHyliz0yCa1G903ZXI/FuHy2w== "@babel/helper-regex@^7.0.0": version "7.0.0" @@ -191,23 +194,28 @@ "@babel/traverse" "^7.1.0" "@babel/types" "^7.0.0" -"@babel/helper-replace-supers@^7.1.0": - version "7.1.0" - resolved "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.1.0.tgz" - integrity sha512-BvcDWYZRWVuDeXTYZWxekQNO5D4kO55aArwZOTFXw6rlLQA8ZaDicJR1sO47h+HrnCiDFiww0fSPV0d713KBGQ== +"@babel/helper-replace-supers@^7.1.0", "@babel/helper-replace-supers@^7.24.1": + version "7.24.1" + resolved "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.24.1.tgz" + integrity sha512-QCR1UqC9BzG5vZl8BMicmZ28RuUBnHhAMddD8yHFHDRH9lLTZ9uUPehX8ctVPT8l0TKblJidqcgUUKGVrePleQ== dependencies: - "@babel/helper-member-expression-to-functions" "^7.0.0" - "@babel/helper-optimise-call-expression" "^7.0.0" - "@babel/traverse" "^7.1.0" - "@babel/types" "^7.0.0" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-member-expression-to-functions" "^7.23.0" + "@babel/helper-optimise-call-expression" "^7.22.5" -"@babel/helper-simple-access@^7.1.0": - version "7.1.0" - resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz" - integrity sha512-Vk+78hNjRbsiu49zAPALxTb+JUQCz1aolpd8osOF16BGnLtseD21nbHgLPGUwrXEurZgiCOUmvs3ExTu4F5x6w== +"@babel/helper-simple-access@^7.22.5": + version "7.22.5" + resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz" + integrity sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w== dependencies: - "@babel/template" "^7.1.0" - "@babel/types" "^7.0.0" + "@babel/types" "^7.22.5" + +"@babel/helper-skip-transparent-expression-wrappers@^7.22.5": + version "7.22.5" + resolved "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.22.5.tgz" + integrity sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q== + dependencies: + "@babel/types" "^7.22.5" "@babel/helper-split-export-declaration@^7.0.0", "@babel/helper-split-export-declaration@^7.22.6": version "7.22.6" @@ -226,6 +234,11 @@ resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz" integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== +"@babel/helper-validator-option@^7.23.5": + version "7.23.5" + resolved "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz" + integrity sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw== + "@babel/helper-wrap-function@^7.1.0": version "7.2.0" resolved "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.2.0.tgz" @@ -324,6 +337,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-syntax-jsx@^7.24.1": + version "7.24.1" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.1.tgz" + integrity sha512-2eCtxZXf+kbkMIsXS4poTvT4Yu5rXiRa+9xGVT56raghjmBTKMpFNc9R4IDiB4emao9eO22Ox7CxuJG7BgExqA== + dependencies: + "@babel/helper-plugin-utils" "^7.24.0" + "@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.2.0": version "7.2.0" resolved "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz" @@ -338,12 +358,12 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-typescript@^7.2.0": - version "7.3.3" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.3.3.tgz" - integrity sha512-dGwbSMA1YhVS8+31CnPR7LB4pcbrzcV99wQzby4uAfrkZPYZlQ7ImwdpzLqi6Z6IL02b8IAL379CaMwo0x5Lag== +"@babel/plugin-syntax-typescript@^7.24.1": + version "7.24.1" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.1.tgz" + integrity sha512-Yhnmvy5HZEnHUty6i++gcfH1/l68AHnItFHnaCv6hn9dNh0hQvvQJsxpi4BMBFN5DLeHBuucT/0DgzXif/OyRw== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.24.0" "@babel/plugin-transform-arrow-functions@^7.2.0": version "7.2.0" @@ -458,14 +478,14 @@ "@babel/helper-module-transforms" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-modules-commonjs@^7.2.0": - version "7.2.0" - resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.2.0.tgz" - integrity sha512-V6y0uaUQrQPXUrmj+hgnks8va2L0zcZymeU7TtWEgdRLNkceafKXEduv7QzgQAE4lT+suwooG9dC7LFhdRAbVQ== +"@babel/plugin-transform-modules-commonjs@^7.2.0", "@babel/plugin-transform-modules-commonjs@^7.24.1": + version "7.24.1" + resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.24.1.tgz" + integrity sha512-szog8fFTUxBfw0b98gEWPaEqF42ZUD/T3bkynW/wtgx2p/XCP55WEsb+VosKceRSd6njipdZvNogqdtI4Q0chw== dependencies: - "@babel/helper-module-transforms" "^7.1.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-simple-access" "^7.1.0" + "@babel/helper-module-transforms" "^7.23.3" + "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-simple-access" "^7.22.5" "@babel/plugin-transform-modules-systemjs@^7.2.0": version "7.2.0" @@ -551,13 +571,15 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-typescript@^7.3.2": - version "7.3.2" - resolved "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.3.2.tgz" - integrity sha512-Pvco0x0ZSCnexJnshMfaibQ5hnK8aUHSvjCQhC1JR8eeg+iBwt0AtCO7gWxJ358zZevuf9wPSO5rv+WJcbHPXQ== +"@babel/plugin-transform-typescript@^7.24.1": + version "7.24.4" + resolved "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.24.4.tgz" + integrity sha512-79t3CQ8+oBGk/80SQ8MN3Bs3obf83zJ0YZjDmDaEZN8MqhMI760apl5z6a20kFeMXBwJX99VpKT8CKxEBp5H1g== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-typescript" "^7.2.0" + "@babel/helper-annotate-as-pure" "^7.22.5" + "@babel/helper-create-class-features-plugin" "^7.24.4" + "@babel/helper-plugin-utils" "^7.24.0" + "@babel/plugin-syntax-typescript" "^7.24.1" "@babel/plugin-transform-unicode-regex@^7.2.0": version "7.2.0" @@ -624,12 +646,15 @@ semver "^5.3.0" "@babel/preset-typescript@^7.3.3": - version "7.3.3" - resolved "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.3.3.tgz" - integrity sha512-mzMVuIP4lqtn4du2ynEfdO0+RYcslwrZiJHXu4MGaC1ctJiW2fyaeDrtjJGs7R/KebZ1sgowcIoWf4uRpEfKEg== + version "7.24.1" + resolved "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.24.1.tgz" + integrity sha512-1DBaMmRDpuYQBPWD8Pf/WEwCrtgRHxsZnP4mIy9G/X+hFfbI47Q2G4t1Paakld84+qsk2fSsUPMKg71jkoOOaQ== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-typescript" "^7.3.2" + "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-validator-option" "^7.23.5" + "@babel/plugin-syntax-jsx" "^7.24.1" + "@babel/plugin-transform-modules-commonjs" "^7.24.1" + "@babel/plugin-transform-typescript" "^7.24.1" "@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.1.2", "@babel/template@^7.22.15": version "7.24.0" @@ -952,9 +977,9 @@ acorn-globals@^4.1.0: acorn-walk "^6.0.1" acorn-jsx@^5.0.0: - version "5.0.1" - resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.1.tgz" - integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== + version "5.3.2" + resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== acorn-walk@^6.0.1: version "6.2.0" @@ -966,12 +991,12 @@ acorn@^5.5.3: resolved "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz" integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg== -acorn@^6.0.0, acorn@^6.0.1, acorn@^6.0.2, acorn@^6.0.5: +"acorn@^6.0.0 || ^7.0.0 || ^8.0.0", acorn@^6.0.1, acorn@^6.0.5, acorn@^6.0.7: version "6.4.2" resolved "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz" integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ== -ajv@^6.5.3, ajv@^6.5.5, ajv@^6.9.1: +ajv@^6.5.5, ajv@^6.9.1: version "6.12.6" resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -1369,11 +1394,6 @@ ci-info@^2.0.0: resolved "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz" integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== -circular-json@^0.3.1: - version "0.3.3" - resolved "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz" - integrity sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A== - class-utils@^0.3.5: version "0.3.6" resolved "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz" @@ -1633,10 +1653,10 @@ diff-sequences@^24.9.0: resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.9.0.tgz" integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew== -doctrine@^2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz" - integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== dependencies: esutils "^2.0.2" @@ -1816,10 +1836,10 @@ eslint-plugin-standard@^4.0.0, eslint-plugin-standard@>=4.0.0: resolved "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-4.0.0.tgz" integrity sha512-OwxJkR6TQiYMmt1EsNRMe5qG3GsbjlcOhbGUBY4LtavF9DsLaTcoR+j2Tdjqi23oUwKNUqX7qcn5fPStafMdlA== -eslint-scope@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz" - integrity sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA== +eslint-scope@^4.0.3: + version "4.0.3" + resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz" + integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== dependencies: esrecurse "^4.1.0" estraverse "^4.1.1" @@ -1844,35 +1864,35 @@ eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== -eslint@^5.13.0, "eslint@>= 4.12.1", "eslint@>= 5.0.0", eslint@>=3.14.1, eslint@>=4.19.1, eslint@>=5.0.0, "eslint@2.x - 5.x": - version "5.13.0" - resolved "https://registry.npmjs.org/eslint/-/eslint-5.13.0.tgz" - integrity sha512-nqD5WQMisciZC5EHZowejLKQjWGuFS5c70fxqSKlnDME+oz9zmE8KTlX+lHSg+/5wsC/kf9Q9eMkC8qS3oM2fg== +eslint@^5.16.0, "eslint@>= 4.12.1", "eslint@>= 5.0.0", eslint@>=3.14.1, eslint@>=4.19.1, eslint@>=5.0.0, "eslint@2.x - 5.x": + version "5.16.0" + resolved "https://registry.npmjs.org/eslint/-/eslint-5.16.0.tgz" + integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg== dependencies: "@babel/code-frame" "^7.0.0" - ajv "^6.5.3" + ajv "^6.9.1" chalk "^2.1.0" cross-spawn "^6.0.5" debug "^4.0.1" - doctrine "^2.1.0" - eslint-scope "^4.0.0" + doctrine "^3.0.0" + eslint-scope "^4.0.3" eslint-utils "^1.3.1" eslint-visitor-keys "^1.0.0" - espree "^5.0.0" + espree "^5.0.1" esquery "^1.0.1" esutils "^2.0.2" - file-entry-cache "^2.0.0" + file-entry-cache "^5.0.1" functional-red-black-tree "^1.0.1" glob "^7.1.2" globals "^11.7.0" ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" - inquirer "^6.1.0" - js-yaml "^3.12.0" + inquirer "^6.2.2" + js-yaml "^3.13.0" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" - lodash "^4.17.5" + lodash "^4.17.11" minimatch "^3.0.4" mkdirp "^0.5.1" natural-compare "^1.4.0" @@ -1883,15 +1903,15 @@ eslint@^5.13.0, "eslint@>= 4.12.1", "eslint@>= 5.0.0", eslint@>=3.14.1, eslint@> semver "^5.5.1" strip-ansi "^4.0.0" strip-json-comments "^2.0.1" - table "^5.0.2" + table "^5.2.3" text-table "^0.2.0" -espree@^5.0.0: - version "5.0.0" - resolved "https://registry.npmjs.org/espree/-/espree-5.0.0.tgz" - integrity sha512-1MpUfwsdS9MMoN7ZXqAr9e9UKdVHDcvrJpyx7mm1WuQlx/ygErEQBzgi5Nh5qBHIoYweprhtMkTCb9GhcAIcsA== +espree@^5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/espree/-/espree-5.0.1.tgz" + integrity sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A== dependencies: - acorn "^6.0.2" + acorn "^6.0.7" acorn-jsx "^5.0.0" eslint-visitor-keys "^1.0.0" @@ -2071,13 +2091,12 @@ figures@^2.0.0: dependencies: escape-string-regexp "^1.0.5" -file-entry-cache@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz" - integrity sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E= +file-entry-cache@^5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz" + integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== dependencies: - flat-cache "^1.2.1" - object-assign "^4.0.1" + flat-cache "^2.0.1" file-uri-to-path@1.0.0: version "1.0.0" @@ -2122,15 +2141,19 @@ find-up@^3.0.0: dependencies: locate-path "^3.0.0" -flat-cache@^1.2.1: - version "1.3.4" - resolved "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.4.tgz" - integrity sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg== +flat-cache@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz" + integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== dependencies: - circular-json "^0.3.1" - graceful-fs "^4.1.2" - rimraf "~2.6.2" - write "^0.2.1" + flatted "^2.0.0" + rimraf "2.6.3" + write "1.0.3" + +flatted@^2.0.0: + version "2.0.2" + resolved "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz" + integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== for-in@^1.0.2: version "1.0.2" @@ -2438,7 +2461,7 @@ ini@^1.3.4: resolved "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== -inquirer@^6.1.0: +inquirer@^6.2.2: version "6.2.2" resolved "https://registry.npmjs.org/inquirer/-/inquirer-6.2.2.tgz" integrity sha512-Z2rREiXA6cHRR9KBOarR3WuLlFzlIfAEIiB45ll5SSadMg7WqOh1MKEjjndfuH5ewXdixWCxqnVfGOQzPeiztA== @@ -3073,7 +3096,7 @@ js-levenshtein@^1.1.3: resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@^3.12.0, js-yaml@^3.13.1: +js-yaml@^3.13.0, js-yaml@^3.13.1: version "3.14.1" resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz" integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== @@ -3275,7 +3298,7 @@ lodash.sortby@^4.7.0: resolved "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz" integrity sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA== -lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.19, lodash@^4.17.5: +lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.19: version "4.17.21" resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -3530,11 +3553,6 @@ oauth-sign@~0.9.0: resolved "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz" integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== -object-assign@^4.0.1: - version "4.1.1" - resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz" - integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= - object-copy@^0.1.0: version "0.1.0" resolved "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz" @@ -4125,7 +4143,7 @@ ret@~0.1.10: resolved "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== -rimraf@^2.5.4, rimraf@^2.6.2, rimraf@^2.6.3, rimraf@~2.6.2: +rimraf@^2.5.4, rimraf@^2.6.2, rimraf@^2.6.3, rimraf@2.6.3: version "2.6.3" resolved "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz" integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== @@ -4265,6 +4283,11 @@ semver@^6.2.0: resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== +semver@^6.3.1: + version "6.3.1" + resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== + serialize-javascript@^2.1.2: version "2.1.2" resolved "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz" @@ -4570,7 +4593,7 @@ symbol-tree@^3.2.2: resolved "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz" integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== -table@^5.0.2: +table@^5.2.3: version "5.2.3" resolved "https://registry.npmjs.org/table/-/table-5.2.3.tgz" integrity sha512-N2RsDAMvDLvYwFcwbPyF3VmVSSkuF+G1e+8inhBLtHpvwXGw4QRPEZhihQNeEN0i1up6/f6ObCJXNdlRG3YVyQ== @@ -4911,10 +4934,10 @@ write-file-atomic@2.4.1: imurmurhash "^0.1.4" signal-exit "^3.0.2" -write@^0.2.1: - version "0.2.1" - resolved "https://registry.npmjs.org/write/-/write-0.2.1.tgz" - integrity sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c= +write@1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/write/-/write-1.0.3.tgz" + integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== dependencies: mkdirp "^0.5.1" From ad219cf3815b04272ddf32d08a835aca6c0382dd Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 25 Apr 2024 13:18:54 -0500 Subject: [PATCH 2/2] chore(Babel): Add optional chaining for babel plugins --- .babelrc | 3 ++- package-lock.json | 32 +++++++++++++++++++++++++++++++- package.json | 3 ++- src/diffUtils.ts | 9 --------- yarn.lock | 20 ++++++++++++++++++-- 5 files changed, 53 insertions(+), 14 deletions(-) diff --git a/.babelrc b/.babelrc index f34ccd9..8655001 100644 --- a/.babelrc +++ b/.babelrc @@ -5,6 +5,7 @@ ], "plugins": [ "@babel/proposal-class-properties", - "@babel/proposal-object-rest-spread" + "@babel/proposal-object-rest-spread", + "@babel/plugin-transform-optional-chaining" ] } diff --git a/package-lock.json b/package-lock.json index fa7f925..08438ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,9 +13,10 @@ "@babel/core": "^7.2.0", "@babel/plugin-proposal-class-properties": "^7.2.1", "@babel/plugin-proposal-object-rest-spread": "^7.2.0", + "@babel/plugin-transform-optional-chaining": "^7.24.1", "@babel/polyfill": "^7.2.5", "@babel/preset-env": "^7.2.0", - "@babel/preset-typescript": "^7.3.3", + "@babel/preset-typescript": "^7.24.1", "babel-eslint": "^10.0.1", "babel-jest": "^24.1.0", "babel-polyfill": "^6.26.0", @@ -649,6 +650,18 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-syntax-typescript": { "version": "7.24.1", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.1.tgz", @@ -918,6 +931,23 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-transform-optional-chaining": { + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.24.1.tgz", + "integrity": "sha512-n03wmDt+987qXwAgcBlnUUivrZBPZ8z1plL0YvgQalLm+ZE5BMhGm94jhxXtA1wzv1Cu2aaOv1BM9vbVttrzSg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.0", + "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", + "@babel/plugin-syntax-optional-chaining": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-transform-parameters": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.2.0.tgz", diff --git a/package.json b/package.json index 4ddcfeb..bb5f85b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "helping_hand", "description": "Javascript helper utilities for applications", - "version": "0.1.0", + "version": "0.2.0", "license": "MIT", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -29,6 +29,7 @@ "@babel/core": "^7.2.0", "@babel/plugin-proposal-class-properties": "^7.2.1", "@babel/plugin-proposal-object-rest-spread": "^7.2.0", + "@babel/plugin-transform-optional-chaining": "^7.24.1", "@babel/polyfill": "^7.2.5", "@babel/preset-env": "^7.2.0", "@babel/preset-typescript": "^7.24.1", diff --git a/src/diffUtils.ts b/src/diffUtils.ts index 4b7214d..753ef75 100644 --- a/src/diffUtils.ts +++ b/src/diffUtils.ts @@ -114,12 +114,3 @@ function _diffInnerCheck (int: IntType, update: UpdateType, diffVal: DiffType, k diffVal[key] = options?.convertNullToUndefined ? undefined : update } } - -interface LengthOfArg { - length: number; -} - -function logLength(arg: Type): Type { - console.log(arg.length); - return arg; -} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 476171b..af6447d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -171,7 +171,7 @@ dependencies: "@babel/types" "^7.22.5" -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.24.0": +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.24.0", "@babel/helper-plugin-utils@^7.8.0": version "7.24.0" resolved "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.0.tgz" integrity sha512-9cUznXMG0+FxRuJfvL82QlTqIzhVW9sL0KjMPHhAOOvpQGL8QtdxnBKILjBqxlHyliz0yCa1G903ZXI/FuHy2w== @@ -358,6 +358,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-syntax-optional-chaining@^7.8.3": + version "7.8.3" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz" + integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + "@babel/plugin-syntax-typescript@^7.24.1": version "7.24.1" resolved "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.1.tgz" @@ -518,6 +525,15 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-replace-supers" "^7.1.0" +"@babel/plugin-transform-optional-chaining@^7.24.1": + version "7.24.1" + resolved "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.24.1.tgz" + integrity sha512-n03wmDt+987qXwAgcBlnUUivrZBPZ8z1plL0YvgQalLm+ZE5BMhGm94jhxXtA1wzv1Cu2aaOv1BM9vbVttrzSg== + dependencies: + "@babel/helper-plugin-utils" "^7.24.0" + "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + "@babel/plugin-transform-parameters@^7.2.0": version "7.2.0" resolved "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.2.0.tgz" @@ -645,7 +661,7 @@ js-levenshtein "^1.1.3" semver "^5.3.0" -"@babel/preset-typescript@^7.3.3": +"@babel/preset-typescript@^7.24.1": version "7.24.1" resolved "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.24.1.tgz" integrity sha512-1DBaMmRDpuYQBPWD8Pf/WEwCrtgRHxsZnP4mIy9G/X+hFfbI47Q2G4t1Paakld84+qsk2fSsUPMKg71jkoOOaQ==