FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

CliftonH/objectpath: Parse js object paths using both dot and bracket notation. Stringify an array of properties into a valid path. · GitHub

 
 

Latest commit

 

History

34 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ObjectPath

Parse js object paths using both dot and bracket notation. Stringify an array of properties into a valid path.

  • parse JS object reference fragments
  • build JS object reference fragments
  • supports presence of unicode characters
  • supports presence of control characters in key names

Parse a Path

ObjectPath.parse(str)

var ObjectPath = require('objectpath');

ObjectPath.parse('a[1].b.c.d["e"]["f"].g');
// => ['a','1','b','c','d','e','f','g']

Build a Path String

ObjectPath.stringify(arr, [quote=''']);

var ObjectPath = require('objectpath');

ObjectPath.stringify(['a','1','b','c','d','e','f','g']);
// => '[\'a\'][\'1\'][\'b\'][\'c\'][\'d\'][\'e\'][\'f\'][\'g\']'


ObjectPath.stringify(['a','1','b','c','d','e','f','g'],'"');
// => '["a"]["1"]["b"]["c"]["d"]["e"]["f"]["g"]'

Normalize a Path

ObjectPath.normalize(str)

var ObjectPath = require('objectpath');

ObjectPath.parse('a[1].b.c.d["e"]["f"].g');
// => '["a"]["1"]["b"]["c"]["d"]["e"]["f"]["g"]'

About

Parse js object paths using both dot and bracket notation. Stringify an array of properties into a valid path.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages


Back | FazBrowse Home | New Git URL