9.15.120 • Published 12 months ago

@womorg/temporibus-corporis-omnis v9.15.120

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

@womorg/temporibus-corporis-omnis

Safely flatten a nested JavaScript object.

NPM

Commitizen friendly js-standard-style Build Coverage Known Vulnerabilities

Installation

$ npm i @womorg/temporibus-corporis-omnis

Methods

flatten(obj, delimiter)

Flattens an object to one level deep. Optionally takes a custom delimiter, otherwise uses . by default. Circular references within the object will be replaced with [Circular].

const { flatten } = require('@womorg/temporibus-corporis-omnis')

const original = {
    a: {
        b: {
            c: [{
                val: 'one'
            }, {
                val: 'two'
            }],
            d: 'three'
        },
        e: 'four',
    }
}
original.a.b.f = original.a.b
original.a.b.c.push(original.a)

const flat = flatten(original)
/*
{
  'a.b.c.0.val': 'one',
  'a.b.c.1.val': 'two',
  'a.b.c.2': '[Circular]',
  'a.b.d': 'three',
  'a.e': 'four',
  'a.b.f': '[Circular]'
}
*/

const underscoreFlat = flatten(original, '_')
/*
{
  'a_b_c_0_val': 'one',
  'a_b_c_1_val': 'two',
  'a_b_c_2': '[Circular]',
  'a_b_d': 'three',
  'a_e': 'four',
  'a_b_f': '[Circular]'
}
*/

unflatten(obj, delimiter)

Unflattens an object back to its original nested form. Optionally takes a custom delimiter, otherwise uses . by default. Circular references denoted by [Circular] are treated as Strings.

const { unflatten } = require('@womorg/temporibus-corporis-omnis')

const original = {
    'a.b.c.0.val': 'one',
    'a.b.c.1.val': 'two',
    'a.b.c.2': '[Circular]',
    'a.b.d': 'three',
    'a.e': 'four',
    'a.b.f': '[Circular]'
}


const unflat = unflatten(original)

/*{
  a:{
    b:{
      c:[
        {
          val:'one'
        },
        {
          val:'two'
        },
        '[Circular]'
      ],
      d:'three',
      f:'[Circular]'
    },
    e:'four'
  }
}*/
ReactiveXthroatimmutablechinesewindowslinuxtypeerrorcolumnmonorepopackageECMAScript 2015es5cryptoprunebyteLengthjsdomuninstallES5hookformvpcArray.prototype.includesflatMaprestsymlinkjoimobiledom-testing-libraryauthenticationpersistentexit-coderegular expressionsmkdirpinstallerrorcommand-line$.extendarrayfindyaml@@toStringTagflatJSONchromiumcloudformationcallspinnersxtermratelimitrouterterminalvariablesenvironmentjapanesequeuestringifyworkerregular expressionObservablesrecursiveES7asthttpObject.isiterationArrayBufferprototypepreserve-symlinksSymbol.toStringTagamazonawesomesaucesharedarraybufferiefast-copymixinsmruqueueMicrotaskfindLastIndexdeep-cloneomitrequireES2019chromehigher-ordertc39serializationlastwordbreaknodecssjsxwritablequoteconfigfseslintplugincall-bindArrayBuffer.prototype.sliceuuiderror-handlingawaithookssortsigintendpointrequest[[Prototype]]proprm -rfwordwrapeveryflagTypeBoxstreams2whatwgObject.definePropertyloadinggetOwnPropertyDescriptorprotoes-shimshttpshascreatetimees2017fseventsencryption256private datadeleteRxJSES2016TypedArrayECMAScript 7Uint8ArrayjsdiffschemeHyBibundlerfasttypesafetoolkitworkflowpicomatchmkdirstypedtrimRightreduxrmdirelmECMAScript 2019removeObject.getPrototypeOfelectronponyfillfast-deep-copyECMAScript 2021sharedparsingRFC-6455inlazyguidlistenersreactbrowserStreamspositiverangeerrorargumentsignalaccessorcallbindlognamesfastcopyRegExp.prototype.flagsasciicomparecensorautoscalingcolorcopyflagsroutingMapWebSocketperformantpostcsscolorsextendnopeless cssreducersafeFloat64Arraycollection.es6formatdayjsglobECMAScript 3sigtermecmascriptmomentfolderscheme-validationroute53ebsbcryptdirectoryes-abstractcacheescapedomsyntaxerrorArrayBuffer#slicegetPrototypeOffull-widthsuperstructstreamsstarterredactes-shim APIcloneECMAScript 2023package.jsonquerystringvalidateroutearktypewatchermodulesmimetypeswgetBigUint64ArrayformattinginstallerdiffUnderscorerm -frMicrosoftfromreplayshrinkwraptypeswatchingobj_.extenddeepcopyexitminimaloffsetECMAScript 2018stabledireslintvisualcloudfrontfast-clonelimitfunctionalES2022emrES2015argvprotocol-buffersECMAScript 2020invariantsearchstylestypedarraychannelcss nestingl10nduplexgetintrinsicObject.fromEntriespolyfillpipenodejsdefineutil.inspectmakesetImmediatelessincludesreadableboundsnspyyamljsonpathemojiwalkdeep-copycoerciblecommandUint32ArraysymlinksstatelessimportexportauthobjectunicodetraverseinferencelimitedcharactersruntimeES3genericsfunctionestreeawsfunctionspatchparseinterruptscontainszodeventsdatalintjwtserializelengthbreaklockfilebootstrap lesskinesisInt8ArraydefinePropertysameValueZerospinnerStyleSheetRxYAMLwidthargstyped arrayArray.prototype.findLastIndexdependency managerBigInt64ArrayloadbalancingFloat32ArrayhasOwngradients cssjsontypeofoutputvalidpromisereal-timestringifiertsiteratorfindLastsyntaxbluebirdmiddlewareparentscjkpathspeedbannerReflect.getPrototypeOfECMAScript 5Pushweaksethas-ownsettingscode pointsdatastructureexpressthrottleES2021TypeScriptjQueryInt16Arrayworkspace:*Iteratordeterministicserializeroncemkdirstringtypescriptdotenvlook-upi18nprivatestylinges7rapidcircularwatchFilecss-in-jsintrinsicsetterprettysuperagenttermwarningexecStreambyteOffsetstyleefficientlinewraptoobjectfpsWeakSethardlinkstapbddObservableargparseObject.keysisConcatSpreadablegdprsesfetchexpressionString.prototype.trimUint8ClampedArraydataViewwatchbundlingObject.entriesdataviewimportpropertiesmatch
9.14.103

1 year ago

9.14.104

12 months ago

9.14.101

1 year ago

9.14.102

1 year ago

9.14.100

1 year ago

9.15.115

12 months ago

9.15.116

12 months ago

9.15.117

12 months ago

9.15.118

12 months ago

9.15.119

12 months ago

9.15.120

12 months ago

9.15.106

12 months ago

9.15.107

12 months ago

9.15.108

12 months ago

9.15.109

12 months ago

9.15.110

12 months ago

9.15.111

12 months ago

9.15.112

12 months ago

9.15.113

12 months ago

9.15.114

12 months ago

9.14.96

1 year ago

9.14.95

1 year ago

9.14.94

1 year ago

9.14.99

1 year ago

9.14.98

1 year ago

9.14.97

1 year ago

9.14.105

12 months ago

9.14.106

12 months ago

9.13.94

1 year ago

9.12.94

1 year ago

9.12.93

1 year ago

8.11.91

1 year ago

8.11.92

1 year ago

9.11.92

1 year ago

9.11.93

1 year ago

8.11.88

1 year ago

8.11.89

1 year ago

8.11.87

1 year ago

8.11.90

1 year ago

8.11.86

1 year ago

8.11.84

1 year ago

8.11.85

1 year ago

8.11.82

1 year ago

8.11.83

1 year ago

8.11.80

1 year ago

8.11.81

1 year ago

8.11.79

1 year ago

7.11.77

1 year ago

7.11.78

1 year ago

7.11.79

1 year ago

7.11.73

1 year ago

7.11.74

1 year ago

7.11.75

1 year ago

7.11.76

1 year ago

7.11.70

1 year ago

7.11.71

1 year ago

7.11.72

1 year ago

7.10.69

1 year ago

7.10.68

1 year ago

7.10.70

1 year ago

6.10.66

1 year ago

6.10.65

1 year ago

6.10.67

1 year ago

7.10.67

1 year ago

6.8.49

1 year ago

6.8.48

1 year ago

6.8.47

1 year ago

6.8.46

1 year ago

6.10.64

1 year ago

6.10.63

1 year ago

6.10.62

1 year ago

6.10.61

1 year ago

6.10.60

1 year ago

4.5.34

1 year ago

4.5.35

1 year ago

6.8.45

1 year ago

6.9.53

1 year ago

6.9.52

1 year ago

5.6.40

1 year ago

5.6.41

1 year ago

6.10.55

1 year ago

6.10.54

1 year ago

6.10.53

1 year ago

5.5.37

1 year ago

5.5.38

1 year ago

5.5.35

1 year ago

5.5.36

1 year ago

6.10.59

1 year ago

6.10.58

1 year ago

6.10.57

1 year ago

6.10.56

1 year ago

3.5.34

1 year ago

6.6.41

1 year ago

5.6.39

1 year ago

5.6.38

1 year ago

6.7.45

1 year ago

6.7.41

1 year ago

6.7.42

1 year ago

6.7.43

1 year ago

6.7.44

1 year ago

6.8.52

1 year ago

6.8.51

1 year ago

6.8.50

1 year ago

3.5.33

1 year ago

3.5.32

1 year ago

3.5.31

1 year ago

3.5.30

1 year ago

3.5.29

1 year ago

3.4.27

1 year ago

3.4.28

1 year ago

3.5.28

1 year ago

3.0.23

1 year ago

3.0.24

1 year ago

3.2.26

1 year ago

3.0.21

1 year ago

3.0.22

1 year ago

3.2.27

1 year ago

3.0.25

1 year ago

3.0.26

1 year ago

3.0.20

1 year ago

3.0.19

1 year ago

3.3.27

1 year ago

3.1.26

1 year ago

3.0.17

1 year ago

3.0.18

1 year ago

3.0.13

1 year ago

3.0.16

1 year ago

3.0.14

1 year ago

3.0.15

1 year ago

3.0.12

1 year ago

3.0.11

1 year ago

3.0.10

1 year ago

3.0.9

1 year ago

3.0.8

1 year ago

2.0.8

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.3

1 year ago

2.0.4

1 year ago

2.0.2

1 year ago

1.0.1

1 year ago

2.0.1

1 year ago

1.0.0

1 year ago