7.14.123 • Published 12 months ago

@womorg/ea-laborum-magnam v7.14.123

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

@womorg/ea-laborum-magnam

Safely flatten a nested JavaScript object.

NPM

Commitizen friendly js-standard-style Build Coverage Known Vulnerabilities

Installation

$ npm i @womorg/ea-laborum-magnam

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/ea-laborum-magnam')

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/ea-laborum-magnam')

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'
  }
}*/
monorepomrutouchworkspace:*shames7ECMAScript 6setteryupfsenvCSSStyleDeclarationiteratorcollectionpropertiesmakegetterprotosetImmediatedescriptorsECMAScript 3route53Object.definePropertyutil.inspectdeep-cloneeslint-plugindeep-copycopyUint16Arraycloudtrailtypanionroutercss nestinges-shim APIserializervarskarmaimportomitasyncdefineflagtostringtagjestdataviewtrimRightFloat32Arraygradients cssbatchcomputed-typesmatchesString.prototype.trimjQueryrequestbrowserlistidecmascriptArrayBuffer.prototype.sliceconnectpasswordes8URLinputfetchinternalES3avareducerfilterpipearraybuffercallprototypeless.jshelpersownoptimiststreamdeepcopyfullguidsigintwatchisConcatSpreadable_.extendprefixstyled-componentsES2017telephonelinewrapgetOwnPropertyDescriptorbundlingReactiveExtensionseveryappsuperstructArray.prototype.flat__proto__package managertrimless compilergroupBypromiseArray.prototype.filterbreakArray.prototype.findLastoncereadablestreamtestingdebuggerloggerobjclonescheme-validationtsObject.assignUint32ArraylinuxsequencedynamodbfindECMAScript 2019reusedeleteimportexportReactiveXruntimetrimEnd@@toStringTagassertnumbertypedarrayObject.issqsiampathhttpelectroneventDispatcheraccessorless csskinesisECMAScript 2020urlresolveparseprivate datareact-testing-libraryphoneoptiones2015dependency managerqueueMicrotaskroutingcall-bindtypedarraystc39redactcallboundfseventsJSON-Schemajoipostcss$.extendfpsauthStyleSheetebspropertycloudwatchexecbundlerstablecollection.es6efficientBigInt64Arraycontainsjshintreact-hooksvalueshasOwnProperty0-0negative zeroreduxpreserve-symlinkscompile lesshas-ownpackage.jsonnoperequirefindLastIndexdatastructureajaxdataViewjsonarraysURLSearchParamsmime-dbbounddirfindLastartcloudformationformattinghashJSONtimerangeerrorbrowserslistsymbolsdom-testing-librarynodejsoperating-systemtesterqueuecensorwatchermodulescryptonodehttpsMicrosoftbrowsereslintconfigproxyflatenvironmentsquerysymlinkstypescriptstringifierthroatgenericswritebufferscore-jstoolkitintrinsiccircularargvSymbolbootstrap lessECMAScript 2017globalelasticachesameValueZerostoragegatewayprotocol-buffershookslimitapithrottleslicenested cssECMAScript 7regular expressioncss-in-jsdebugenumerableES5pushwarningzerotypeBigUint64Arraymixinsdescriptorstylesparentsrateobjectinstalleres-abstractchannelweakmapform-validationformatpatchstylecallbackautoscalinglanguagesafexhrObservableprogressAsyncIteratormatchfunctionwidthextensionrgbcurlremovebyteOffsetfull-widthnativewatchingspeedargparseWeakMapvestnamesauthenticationUint8ClampedArraycolorprettyutiltypeofpackageArray.prototype.containsfast-cloneES2022ratelimitglobhardlinksvariableserrorcompilerweaksetcharacterbdda11ys3amazonwatchFileuninstallzodjsonpathclassessignal256handlersfastcopyes-shimssymlinkES2021getPrototypeOfInt16Arrayreplayloadingelbstatelesslogclassnamevalidatelengthtypeerrorswfes2017idleCSSinspectsyntaxautoprefixercjkArray.prototype.flattenawesomesaucecorsprocesselmes6ponyfillagentrfc4122specfiglet
5.12.109

12 months ago

5.12.108

12 months ago

5.12.113

12 months ago

5.12.112

12 months ago

5.12.111

12 months ago

5.12.110

12 months ago

4.10.103

1 year ago

5.10.107

1 year ago

4.10.104

1 year ago

5.12.116

12 months ago

4.10.105

1 year ago

5.12.115

12 months ago

4.10.106

1 year ago

5.12.114

12 months ago

4.10.107

1 year ago

7.13.122

12 months ago

7.13.123

12 months ago

5.11.108

1 year ago

5.11.107

1 year ago

5.13.116

12 months ago

6.13.117

12 months ago

6.13.118

12 months ago

6.13.119

12 months ago

5.13.117

12 months ago

6.13.120

12 months ago

6.13.121

12 months ago

6.13.122

12 months ago

7.14.123

12 months ago

4.10.100

1 year ago

4.10.101

1 year ago

4.10.102

1 year ago

4.10.98

1 year ago

4.10.99

1 year ago

4.10.96

1 year ago

4.10.97

1 year ago

4.9.93

1 year ago

4.10.94

1 year ago

4.10.95

1 year ago

4.10.93

1 year ago

4.9.91

1 year ago

4.9.90

1 year ago

4.9.92

1 year ago

4.9.86

1 year ago

4.9.88

1 year ago

4.9.87

1 year ago

4.9.89

1 year ago

4.9.82

1 year ago

4.9.84

1 year ago

4.9.83

1 year ago

4.9.85

1 year ago

4.9.79

1 year ago

4.9.78

1 year ago

4.9.80

1 year ago

4.9.81

1 year ago

4.9.75

1 year ago

4.9.77

1 year ago

4.9.76

1 year ago

4.9.73

1 year ago

4.9.74

1 year ago

3.9.73

1 year ago

3.7.73

1 year ago

3.7.72

1 year ago

3.6.72

1 year ago

3.8.73

1 year ago

3.6.69

1 year ago

3.6.68

1 year ago

3.6.67

1 year ago

3.6.66

1 year ago

2.5.47

1 year ago

2.4.36

1 year ago

2.5.48

1 year ago

2.5.49

1 year ago

2.5.43

1 year ago

2.5.44

1 year ago

2.5.45

1 year ago

2.5.46

1 year ago

2.5.40

1 year ago

2.5.41

1 year ago

2.5.42

1 year ago

3.5.66

1 year ago

2.5.58

1 year ago

2.5.59

1 year ago

2.5.54

1 year ago

2.5.55

1 year ago

3.6.71

1 year ago

2.5.56

1 year ago

3.6.70

1 year ago

2.5.57

1 year ago

2.5.50

1 year ago

2.5.51

1 year ago

2.5.52

1 year ago

2.5.53

1 year ago

2.5.60

1 year ago

2.5.65

1 year ago

2.5.66

1 year ago

2.5.61

1 year ago

2.5.62

1 year ago

2.5.63

1 year ago

2.5.64

1 year ago

2.5.36

1 year ago

2.5.37

1 year ago

2.5.38

1 year ago

2.5.39

1 year ago

2.4.35

1 year ago

2.4.32

1 year ago

2.4.31

1 year ago

2.4.34

1 year ago

2.4.33

1 year ago

2.4.30

1 year ago

2.4.29

1 year ago

2.4.28

1 year ago

2.4.18

1 year ago

2.4.17

1 year ago

2.4.19

1 year ago

2.4.16

1 year ago

2.4.25

1 year ago

2.4.24

1 year ago

2.4.27

1 year ago

2.4.26

1 year ago

2.4.21

1 year ago

2.4.20

1 year ago

2.4.23

1 year ago

2.4.22

1 year ago

2.4.14

1 year ago

2.4.15

1 year ago

2.4.13

1 year ago

2.4.10

1 year ago

2.4.12

1 year ago

2.4.11

1 year ago

2.4.9

1 year ago

2.3.9

1 year ago

2.2.9

1 year ago

2.2.8

1 year ago

2.1.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.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago