9.15.120 • Published 10 months ago

@womorg/temporibus-corporis-omnis v9.15.120

Weekly downloads
-
License
MIT
Repository
github
Last release
10 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

11 months ago

9.14.104

11 months ago

9.14.101

11 months ago

9.14.102

11 months ago

9.14.100

11 months ago

9.15.115

10 months ago

9.15.116

10 months ago

9.15.117

10 months ago

9.15.118

10 months ago

9.15.119

10 months ago

9.15.120

10 months ago

9.15.106

10 months ago

9.15.107

10 months ago

9.15.108

10 months ago

9.15.109

10 months ago

9.15.110

10 months ago

9.15.111

10 months ago

9.15.112

10 months ago

9.15.113

10 months ago

9.15.114

10 months ago

9.14.96

11 months ago

9.14.95

11 months ago

9.14.94

11 months ago

9.14.99

11 months ago

9.14.98

11 months ago

9.14.97

11 months ago

9.14.105

11 months ago

9.14.106

11 months ago

9.13.94

11 months ago

9.12.94

11 months ago

9.12.93

11 months ago

8.11.91

11 months ago

8.11.92

11 months ago

9.11.92

11 months ago

9.11.93

11 months ago

8.11.88

11 months ago

8.11.89

11 months ago

8.11.87

11 months ago

8.11.90

11 months ago

8.11.86

11 months ago

8.11.84

11 months ago

8.11.85

11 months ago

8.11.82

11 months ago

8.11.83

11 months ago

8.11.80

12 months ago

8.11.81

11 months ago

8.11.79

12 months ago

7.11.77

12 months ago

7.11.78

12 months ago

7.11.79

12 months ago

7.11.73

12 months ago

7.11.74

12 months ago

7.11.75

12 months ago

7.11.76

12 months ago

7.11.70

12 months ago

7.11.71

12 months ago

7.11.72

12 months ago

7.10.69

12 months ago

7.10.68

12 months ago

7.10.70

12 months ago

6.10.66

12 months ago

6.10.65

12 months ago

6.10.67

12 months ago

7.10.67

12 months 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

12 months 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