How to use the @adobe/helix-shared.string function in @adobe/helix-shared

To help you get started, we’ve selected a few @adobe/helix-shared examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adobe / helix-pipeline / test / testHTMLFromMarkdown.js View on Github external
/*
 * Copyright 2018 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
/* eslint-env mocha */
const { Logger } = require('@adobe/helix-shared');
const { JSDOM } = require('jsdom');
const { multiline } = require('@adobe/helix-shared').string;
const { assertEquivalentNode } = require('@adobe/helix-shared').dom;
const { pipe } = require('../src/defaults/html.pipe.js');

const params = {
  path: '/hello.md',
  __ow_method: 'get',
  owner: 'trieloff',
  __ow_headers: {
    'X-Forwarded-Port': '443',
    'X-CDN-Request-Id': '2a208a89-e071-44cf-aee9-220880da4c1e',
    'Fastly-Client': '1',
    'X-Forwarded-Host': 'runtime.adobe.io',
    'Upgrade-Insecure-Requests': '1',
    Host: 'controller-a',
    Connection: 'close',
    'Fastly-SSL': '1',
github adobe / helix-pipeline / test / testFrontmatter.js View on Github external
/*
 * Copyright 2018 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
/* eslint-env mocha */
const assert = require('assert');
const { cloneDeep } = require('lodash');
const yaml = require('js-yaml');
const { multiline } = require('@adobe/helix-shared').string;
const { SimpleInterface, ConsoleLogger } = require('@adobe/helix-log');
const {
  flattenTree, concat, each,
} = require('ferrum');
const parseMd = require('../src/html/parse-markdown');
const parseFront = require('../src/html/parse-frontmatter');

const { FrontmatterParsingError } = parseFront;

let warning;

const logger = new SimpleInterface({ logger: new ConsoleLogger() });

const procMd = (md) => {
  const dat = { content: { body: multiline(md) } };
  parseMd(dat, { logger });