1.0.0 • Published 14 days ago

@hoangcung1804npm/ex-voluptas-minus v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
14 days ago

@hoangcung1804npm/ex-voluptas-minus

npm version Code Size GitHub license Commitizen friendly Jest Tests GitHub Actions/CI npm downloads

Table of Contents

Getting Started

deepObjectKeyAlternator is a versatile utility function that allows you to recursively parse an object or array of objects, applying a key mapping to rename object keys. It's particularly handy when you need to transform the structure of nested objects while preserving the original data.

Installation

You can install @hoangcung1804npm/ex-voluptas-minus using npm:

npm install @hoangcung1804npm/ex-voluptas-minus

or yarn:

yarn add @hoangcung1804npm/ex-voluptas-minus

or pnpm:

pnpm add @hoangcung1804npm/ex-voluptas-minus

Features

  • Recursively parses nested objects.
  • Customizable key mapping with intellisense support.
  • Supports arrays (without intellisense support).
  • Preserves the structure of arrays.

Usage

Here's how you can use deepObjectKeyAlternator in your projects:

ECMAScript Modules (ESM) Import

import { deepObjectKeyAlternator } from "@hoangcung1804npm/ex-voluptas-minus"

CommonJS (CJS) Import

const { deepObjectKeyAlternator } = require("@hoangcung1804npm/ex-voluptas-minus")

Examples

For Objects (with intellisense support)

import { deepObjectKeyAlternator } from "@hoangcung1804npm/ex-voluptas-minus"
// or const { deepObjectKeyAlternator } = require("@hoangcung1804npm/ex-voluptas-minus")

// Define your input object
const inputObject = {
  id: 95,
  name: "Your Input Data",
  // ... Your input data ...
}

// Use deepObjectKeyAlternator to parse the object
const parsedObject = deepObjectKeyAlternator(inputObject, {
  id: "customId",
  name: "customName",
  // ... Your key mapping ...
})

console.log(parsedObject)
// {
//   customId: 95,
//   customName: 'Your Input Data',
//   // ... Your input data ...
// }

For Arrays (without intellisense support)

import { deepObjectKeyAlternator } from "@hoangcung1804npm/ex-voluptas-minus"
// or const { deepObjectKeyAlternator } = require("@hoangcung1804npm/ex-voluptas-minus");

// Define an array of objects
const inputArray = [
  {
    id: 1,
    name: "Item 1",
  },
  {
    id: 2,
    name: "Item 2",
  },
  // ... More items ...
]

// Use deepObjectKeyAlternator to parse the array of objects
const parsedArray = inputArray.map((item) => {
  return deepObjectKeyAlternator(item, {
    id: "customId",
    name: "customName",
    // ... Your key mapping ...
  })
})

console.log(parsedArray)
// [
//   {
//     customId: 1,
//     customName: 'Item 1',
//     // ... Your input data ...
//   },
//   {
//     customId: 2,
//     customName: 'Item 2',
//     // ... Your input data ...
//   },
//   // ... More items ...
// ]

License

This package is licensed under the MIT License - see the LICENSE file for details.

weaksetjsonpathregexrequireYAMLArray.prototype.flattenkeysURLSearchParamsconcurrencycore-jsmkdirhotsyntaxerrorjQueryelmtoolkitawesomesauceESnextfilterfulltestingspeccall-bindeast-asian-widthnodeflattenimmerrapidproxyreadableHyBiFloat32ArrayArray.prototype.filterreadablestreampolyfillbindArrayBuffer#slicesnsmodulemruprotobuftypedarrayspipepredictablebcryptmoveformatratelimitindicatorespree-0apolloshimStreamsfastcachefpsmochacryptoES2018configurableserializerObject.istoStringTagvalidateFunction.prototype.namewritablesymbolsInt32ArrayinstalljapanesecjkresolveshebangcallbounddomformattingRxwhichextensionsyntaxObject.keyseslintplugingdprmapreducedependenciesslotsymboloptionpromisesafepreserve-symlinksfastcopyarktypereadstyleES5copybootstrap lesstestertrimEndserializewalkingencryptionlesscsstc39visualargvECMAScript 3telephonecloudwatch[[Prototype]]utilitiesiterateroutingcurllinkES2017nativecommandES2015definePropertychineseWebSocketszodfast-clonetoSortedlengthECMAScript 2021colourjasminei18neslint-plugincss nestingagenttapetypesfseventsminimalgenericstaskefficientfileString.prototype.trimwatchFileauthsqscollectionlimiteds3ECMAScript 2016joistylinguuidwhatwgsettercode pointsopentexteventsiamtouchclass-validatoransielbbufferRFC-6455WebSocketcloudsearchflatshampropertiesdatewatchingbreaknpmprivate datamake dirbyteLengthstoragegatewaypromisestrimRightes7sesflagsstyleguideprunechromiumsameValueZeroeslintArray.prototype.findLastIndexECMAScript 2018fast-deep-clonearraybufferdayjslook-upcreateJSON-SchemaES7amazonjsdomloadbalancingdotenvendpointsharedarraybufferObject.getPrototypeOfruntimeoffsetquoteredux-toolkitfluxassertscall-boundsymlinkformoutputisnegativestylesECMAScript 5mergeUint16Arrayredirectless.jsclassnamesiterationsuperstructrm -frglobrgbURLkeyduplexserializationbluebirdcollection.es6ECMAScript 7propaccessoremitCSSStyleDeclarationspinnersBigUint64ArrayhasmiddlewarecodeshasOwnlivetypeofchannelvpcenvironmentidlebrowserslistbundlingqueryFloat64ArraydataViewponyfillchromeremovea11yvalidationttyprotogradients cssObject.entriesemrfullwidthdependency managermetadatajavascriptgroupvaluepackage.jsonspinnerArrayparseexpresstimeexpressionPushpushlistenersbyteOffsetthrottlewarningcliutilityperformantomitworkspace:*asserthigher-ordervaluessymlinkspluginbrowserbannerES2021uninstalljsxstringifiermime-dbstylesheetinspectlintfastifyfastcloneglaciermimelimitperformancedynamodbvestform-validationtostringtagless compilerupdeepfind-upArray.prototype.flatsetImmediatesimpledbdescriptionwgetTypedArraychaixtermgettersetes2016mixinsreact-hook-formexecenvstreams2$.extendhashinternal slottyped arrayless cssregular expressionsCSSvariables in cssdebugequalinES2022queuedropes2017packagesextendfindLastwatchpatchString.prototype.matchAllprogresses-abstractrouteestreereduxec2diffArray.prototype.includeshttpsschemeextracloudformationmimetypesequalitysearchtshasOwnPropertyobjUint8Arrayeslintconfiggetoptio-tswebfull-widthArrayBufferes2015jwtawsl10ntypereactcssenderrmdirnametsliblogpostcssArray.prototype.flatMaploggerrobustebsrmgetintrinsicjsdiffArray.prototype.findLastgradients css3argparselocationescapematchAllcolorsavatoolsisConcatSpreadablefromES2023loadingBigInt64Arrayutil.inspectenumerablehookformwaitgraphqlprotocol-buffersconnectrequestwordbreakReflect.getPrototypeOfregularreplayfigletcharacterwordwrapfunctionales80configdebuggerconcatES2016es-shimsownwriteforEachnameslookcoerciblecompareArray.prototype.containsMicrosoftECMAScript 6yamlfast-deep-copycss variablefsStyleSheetecmascriptelasticacheinternalJSONthroatlockfilecompilerbootstrap cssmatchmkdirpreusereducercryptshrinkwrapES2019rm -rfartES6Symbol.toStringTagtraverseObject.assignwatchertoobjectstringSymbolfindTypeBoxcloudtrailmapspeed_.extendparsertypedSetlibphonenumbertypaniondataviewbrowserlistvariableshelpersAsyncIteratoroptimizerclassnamereact-hooksyupkoreanasciiarrayES8streamspathcallbackpostcss-pluginfixed-widthpicomatchObservablecore@@toStringTagpersistentes6PromisecontainsReactiveXgetOwnPropertyDescriptoroncetestfolderArrayBuffer.prototype.sliceECMAScript 2020invarianttrimcss-in-jspyyamlreducecorsdeleteformsnumber256importexportclientES3emojifast-copystreamsetPrototypeOfes2018concatMappositivepreprocessorprettyObjectjsdeep-clonenopemulti-packageviewdatatakeprivatecloudfrontarraysxhrcommand-linebatch.envbddstdlibcss lessconsumescheme-validationtdddescriptorfunctionscallbindstructuredClonenegative zerocloneObject.definePropertyurlaccessibilityredactworkflowguiddeterministiceventDispatcherkarmaboundTypeScriptcircularfindupRxJSreact-testing-librarysomedeep-copyfile systemclassesflagECMAScript 2015ES2020functionentriesECMAScript 2017columnwrappasswordeverymatchesrdsdefineelectronwafnested csscolumnsawaitdeepcopyhttpECMAScript 2022toArrayairbnbshellframeworktrimStartincludesinstallerieasyncfindLastIndexstatelessmomentbytetapsuperagentcallcompile less
1.0.0

14 days ago