Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor ({ options = {}, $source }) {
super()
// creating Tina-Component members
let members = {
data: options.data(),
compute: options.compute || function () {
return {}
},
...options.methods,
// hooks
...map(pick(options, COMPONENT_HOOKS), (name, handlers) => function (...args) {
return handlers.reduce((memory, handler) => handler.apply(this, args.concat(memory)), void 0)
}),
pageLifetimes: map(pick(options.pageLifetimes, COMPONENT_PAGE_HOOKS), (name, handlers) => function (...args) {
return handlers.reduce((memory, handler) => handler.apply(this, args.concat(memory)), void 0)
}),
adapters: options.adapters,
}
// apply members into instance
for (let name in members) {
this[name] = members[name]
}
return this
}
}
constructor ({ options = {}, $source }) {
super()
// creating Tina-Page members
let members = {
data: options.data(),
compute: options.compute || function () {
return {}
},
...options.methods,
// hooks
...map(pick(options, PAGE_HOOKS), (name, handlers) => function (...args) {
return handlers.reduce((memory, handler) => handler.apply(this, args.concat(memory)), void 0)
}),
adapters: options.adapters,
}
// apply members into instance
for (let name in members) {
this[name] = members[name]
}
return this
}
}
notSupported('behaviors')
}
if (!isEmpty(relations)) {
notSupported('relations')
}
if (!isEmpty(options)) {
notSupported('options')
}
if (!isEmpty(moved)) {
notSupported('moved')
}
return new globals.Component({
data,
props,
methods: map(methods, (key, method) => {
return function () {
return method.apply(this, arguments)
}
}),
didMount () {
// add missing property
this.triggerEvent = function (name, detail, options) {
let listener = this.props[`on${name[0].toUpperCase()}${name.slice(1)}`]
if (listener) {
listener({
detail,
options,
})
}
}
this.id = this.$id
const strategies = (toOptions, fromOptions) => ({
...toOptions,
...map(fromOptions, (key, extra) => {
const strat = strategies[key] || strategies.default
return strat(toOptions[key], extra)
})
})
static toPlainObject (data) {
return map(data, (key, value) => value)
}
}
export function observers (object) {
return map(object || {}, (name, method) => function observer (...args) {
let context = this.__tina_instance__
method.apply(context, args)
})
}
sign () {
this.__signatures = map(this, (key, value) => sigmund(value))
}
ads: (state) => {
return map(state.ads, (key, ad) => {
return {
...ad,
message: JSON.stringify(ad.message),
}
})
},
}
import React from 'react';
import data from '../data';
import objectMap from 'just-map-object';
var categoriesArr = [];
const sizeTipText =
'minfied and gzipped size (data from https://www.npmjs.com/package/package-size)';
objectMap(data, (categoryName, categoryValue) => {
var fnsArr = [];
objectMap(categoryValue.utils, (name, value) => {
fnsArr.push({ name, size: value.size });
});
categoriesArr.push({
name: categoryName,
symbol: categoryValue.symbol,
fns: fnsArr
});
});
export default ({ selected, onSelect }) => {
return (
<section style="{{">
<ul>
{categoriesArr.map((category, i) => (</ul></section>