@coorpacademy/treantjs-adapter-dust
Advanced tools
Comparing version 3.0.0-beta.3-alpha.eb88ee6c to 3.0.1
import map from 'lodash/fp/map'; | ||
import toPairs from 'lodash/fp/toPairs'; | ||
import * as treant from '../core'; | ||
import { renderToString } from '../engine-virtual-dom'; | ||
import paramCase from 'param-case'; | ||
import kebabCase from 'lodash/fp/kebabCase'; | ||
import * as treant from '@coorpacademy/treantjs-core'; | ||
import { renderToString } from '@coorpacademy/treantjs-engine-virtual-dom'; | ||
var toHelpers = function toHelpers(factories) { | ||
var toHelpers = function toHelpers(factories, skin) { | ||
var toHelper = function toHelper(_ref) { | ||
@@ -15,4 +15,4 @@ var key = _ref[0]; | ||
var componentName = paramCase(isFactory); | ||
var Component = factory(treant); | ||
var componentName = kebabCase(isFactory); | ||
var Component = factory(treant, { skin: skin }); | ||
@@ -19,0 +19,0 @@ return function (dust, options) { |
@@ -13,11 +13,11 @@ 'use strict'; | ||
var _core = require('../core'); | ||
var _kebabCase = require('lodash/fp/kebabCase'); | ||
var treant = _interopRequireWildcard(_core); | ||
var _kebabCase2 = _interopRequireDefault(_kebabCase); | ||
var _engineVirtualDom = require('../engine-virtual-dom'); | ||
var _treantjsCore = require('@coorpacademy/treantjs-core'); | ||
var _paramCase = require('param-case'); | ||
var treant = _interopRequireWildcard(_treantjsCore); | ||
var _paramCase2 = _interopRequireDefault(_paramCase); | ||
var _treantjsEngineVirtualDom = require('@coorpacademy/treantjs-engine-virtual-dom'); | ||
@@ -28,3 +28,3 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
var toHelpers = function toHelpers(factories) { | ||
var toHelpers = function toHelpers(factories, skin) { | ||
var toHelper = function toHelper(_ref) { | ||
@@ -37,4 +37,4 @@ var key = _ref[0]; | ||
var componentName = (0, _paramCase2.default)(isFactory); | ||
var Component = factory(treant); | ||
var componentName = (0, _kebabCase2.default)(isFactory); | ||
var Component = factory(treant, { skin: skin }); | ||
@@ -44,3 +44,3 @@ return function (dust, options) { | ||
var vTree = Component(props); | ||
var html = (0, _engineVirtualDom.renderToString)(vTree); | ||
var html = (0, _treantjsEngineVirtualDom.renderToString)(vTree); | ||
chunk.write(html); | ||
@@ -47,0 +47,0 @@ }; |
{ | ||
"name": "@coorpacademy/treantjs-adapter-dust", | ||
"version": "3.0.0-beta.3-alpha.eb88ee6c", | ||
"version": "3.0.1", | ||
"description": "", | ||
@@ -28,2 +28,4 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@coorpacademy/treantjs-core": "^3.0.0", | ||
"@coorpacademy/treantjs-engine-virtual-dom": "^3.0.0", | ||
"lodash": "^4.14.1" | ||
@@ -30,0 +32,0 @@ }, |
import map from 'lodash/fp/map'; | ||
import toPairs from 'lodash/fp/toPairs'; | ||
import * as treant from '../core'; | ||
import {renderToString} from '../engine-virtual-dom'; | ||
import paramCase from 'param-case'; | ||
import kebabCase from 'lodash/fp/kebabCase'; | ||
import * as treant from '@coorpacademy/treantjs-core'; | ||
import {renderToString} from '@coorpacademy/treantjs-engine-virtual-dom'; | ||
const toHelpers = factories => { | ||
const toHelpers = (factories, skin) => { | ||
const toHelper = ([key, factory]) => { | ||
@@ -12,4 +12,4 @@ const isFactory = key.split('create')[1]; | ||
const componentName = paramCase(isFactory); | ||
const Component = factory(treant); | ||
const componentName = kebabCase(isFactory); | ||
const Component = factory(treant, {skin}); | ||
@@ -16,0 +16,0 @@ return (dust, options) => { |
import test from 'ava'; | ||
import isArray from 'lodash/fp/isArray'; | ||
import isFunction from 'lodash/fp/isFunction'; | ||
import createStarRating from '../../../@coorpacademy/components/molecule/star-rating'; | ||
import createCatalogCard from '../../../@coorpacademy/components/molecule/catalog-card'; | ||
import toHelpers from '../dust'; | ||
import toHelpers from '..'; | ||
test('toHelpers should transform factories as helpers', t => { | ||
const factories = {createStarRating, createCatalogCard}; | ||
const factories = { | ||
createStarRating: (_treant, options) => (props, children) => true, | ||
createCatalogCard: (_treant, options) => (props, children) => true | ||
}; | ||
const helpers = toHelpers(factories); | ||
t.true(isArray(helpers)); | ||
@@ -12,0 +15,0 @@ t.true(helpers.length === 2); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
10708
93
1
3
1