liquidless
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -6,3 +6,4 @@ import { Filters } from './filters'; | ||
}; | ||
export declare function renderTemplate(template: string | object, props: object, options?: RenderOptions): string | object | never; | ||
export declare function renderString(template: string, props: object, options?: RenderOptions): string; | ||
export declare function renderObject<T>(object: object, props: object, options?: RenderOptions): T; | ||
export {}; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.renderTemplate = void 0; | ||
exports.renderObject = exports.renderString = void 0; | ||
const flat_1 = __importDefault(require("flat")); | ||
@@ -39,4 +39,5 @@ const rfdc_1 = __importDefault(require("rfdc")); | ||
} | ||
function renderObject(template, props, options) { | ||
const cloned = (0, rfdc_1.default)()(template); | ||
exports.renderString = renderString; | ||
function renderObject(object, props, options) { | ||
const cloned = (0, rfdc_1.default)()(object); | ||
function recursive(obj) { | ||
@@ -55,12 +56,2 @@ for (const key in obj) { | ||
} | ||
// This is just some boilerplate code | ||
function renderTemplate(template, props, options) { | ||
if (typeof template === 'object') { | ||
return renderObject(template, props, options); | ||
} | ||
if (typeof template === 'string') { | ||
return renderString(template, props, options); | ||
} | ||
throw new Error('Expected a string or a object, got: ' + typeof template); | ||
} | ||
exports.renderTemplate = renderTemplate; | ||
exports.renderObject = renderObject; |
{ | ||
"name": "liquidless", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Shopify's Liquid template engine, but less powerful", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -13,6 +13,6 @@ # liquidless | ||
Import the `renderTemplate` function | ||
Import the `renderString` function | ||
```js | ||
import { renderTemplate } from 'liquidless' | ||
import { renderString } from 'liquidless' | ||
``` | ||
@@ -25,3 +25,3 @@ | ||
```js | ||
renderTemplate('Hello, {{ world }}', { world: 'world!' }) | ||
renderString('Hello, {{ world }}', { world: 'world!' }) | ||
``` | ||
@@ -38,3 +38,3 @@ | ||
```js | ||
renderTemplate('Hello, {{ world | upcase }}', { world: 'world!' }) | ||
renderString('Hello, {{ world | upcase }}', { world: 'world!' }) | ||
``` | ||
@@ -51,3 +51,3 @@ | ||
```js | ||
renderTemplate('Hello, {{ world | something: 1, 2, 3 }}', { world: 'world!' }, { | ||
renderString('Hello, {{ world | something: 1, 2, 3 }}', { world: 'world!' }, { | ||
filters: { | ||
@@ -68,3 +68,4 @@ something: (value, args, variable) => `${value} ${args.join(', ')} (${variable})` | ||
```js | ||
renderTemplate([{hello: {world: '{{ world }}'}}], { world: 'world!' }) | ||
import { renderObject } from 'liquidless' | ||
renderObject([{hello: {world: '{{ world }}'}}], { world: 'world!' }) | ||
``` | ||
@@ -71,0 +72,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77
5986
75