npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

s-tablename

0.4.0

@tjholowaychuk

npmHomeRepoSnykSocket
Downloads:0
$ npm install s-tablename
DailyWeeklyMonthlyYearly

Build Status

tablename

Normalize a string or event for use as a Redshift table.

Installation

$ npm install s-tablename

Examples

describe('tablename(str)', function(){
  it('should normalize the string', function(){
    tablename('foo bar baz').should.equal('foo_bar_baz');
    tablename('foo bar-baz').should.equal('foo_bar_baz');
    tablename('foo bar    baz').should.equal('foo_bar_baz');
    tablename('View a Page').should.equal('View_a_Page');
  })
})

describe('tablename(event)', function(){
  it('should return tablename with schema', function(){
    var s = tablename({
      projectId: '12345',
      action: 'Track',
      event: 'View a Page'
    });

    s.should.equal('12345.View_a_Page');
  })
})

License

MIT