Skip to content

chenshaonian/barrow

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

barrow

Usage

var origin ={
  a: '3',
  b: [
    {
      c: 'Peter'
    },
    {
      c: 'Paul'
    }
  ],
  d: {
    e: '300'
  },
  f: -1
};
var mapping = {
  user: Barrow.Types.repeat('b', {
    name: 'c'
  }),
  _page: 'a',
  _extra: {
    status: 'd.e|number'
  },
  _ok: Barrow.Types.func(function (source) {
    return source.f > -1;
  }),
  _from: Barrow.Types.val('barrow')
};
console.log(Barrow(mapping).transfer(source));
// {
//    user: [
//      {
//        name: 'Peter'
//      },
//      {
//        name: 'Paul'
//      }
//    ],
//    _page: '3',
//    _extra: {
//      status: 300
//    },
//    _ok: false,
//    _from: 'barrow'
//  };

License

the MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%