Skip to content

SparseJS flattens deeply-nested objects into sparse objects.

License

Notifications You must be signed in to change notification settings

capital5/sparsejs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SparseJS

Simply put, SparseJS flattens deeply-nested objects into sparse objects.

Example

In

var bar = {
  application: {
    ajax: {
      flag: true,
      number: 73
    },
    gui: {
      flag: false,
      number: 3.14159
    },
    properties: {
      flag: null,
      number: 0
    }
  }
};

Out

{
  "application.ajax.flag": true,
  "application.ajax.number": 73,
  "application.gui.flag": false,
  "application.gui.number": 3.14159,
  "application.properties.flag": null,
  "application.properties.number": 0
}

Why

I had the need for it and thought I'd share the love. I needed to read through a JSON configuration file and flatten it to match a Java properties file.

About

SparseJS flattens deeply-nested objects into sparse objects.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 85.2%
  • HTML 14.8%