Skip to content

ruanyl/with-props

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

with-props

example

test('should be true', t => {
  const rawData = [
    { open: 2, close: 2, low: 1, high: 3 },
    { open: 2, close: 3, low: 2, high: 5 },
    { open: 5, close: 2, low: 2, high: 7 },
  ]
  const props = {
    average: data => data.map(d => (d.open + d.close + d.low + d.high) / 4),
    fixed: 'fixed',
  }
  const results = withProps(props, rawData)
  const expectResults = [
    { open: 2, close: 2, low: 1, high: 3, average: 2, fixed: 'fixed' },
    { open: 2, close: 3, low: 2, high: 5, average: 3, fixed: 'fixed' },
    { open: 5, close: 2, low: 2, high: 7, average: 4, fixed: 'fixed' },
  ]
  t.plan(1)
  t.deepEqual(results, expectResults)
})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published