UNPKG

947 BJavaScriptView Raw
1/* eslint-disable new-cap, no-new */
2'use strict'
3
4const bm = require('./bm')
5const scour = require('../lib/scour')
6
7const data =
8 { artists:
9 { 1: { id: 1, name: 'Ella Fitzgerald' },
10 2: { id: 2, name: 'Frank Sinatra' },
11 3: { id: 3, name: 'Miles Davis' },
12 4: { id: 4, name: 'Taylor Swift' } },
13 albums:
14 { 1: { id: 1, name: 'Kind of Blue', genre: 'Jazz', artist_id: 3 },
15 2: { id: 2, name: 'Come Fly With Me', genre: 'Jazz', artist_id: 2 },
16 3: { id: 3, name: '1984', genre: 'Pop', artist_id: 4 } } }
17
18class SimpleClass {
19 constructor (data, options) {
20 this.data = data
21 this.root = options && options.root || this
22 this.keypath = options && options.keypath || []
23 this.extensions = options && options.extensions || []
24 }
25}
26
27bm('initializing', {
28 'initializing root': function () {
29 new scour(data)
30 },
31 'initializing using a simple class': function () {
32 new SimpleClass(data)
33 }
34})