@lightmill/convert-touchstone
Converts touchstone XML exports to lightmill format.
Last updated 2 years ago by quentinroy .
MIT · Original npm · Tarball · package.json
$ cnpm install @lightmill/convert-touchstone 
SYNC missed versions from official npm registry.

@lightmill/convert-touchstone

Convert a touchstone XML design file as produce by touchstone's design platform to a format that can be directly provided to @lightmill/static-design.

Install

NPM

npm install @lightmill/convert-touchstone

Note: You might not need to install @lightmill/convert-touchstone, npx can be used to download and immediately run the program.

Direct download

Download the latest version then, then in your html file:

<script src="lightmill-convert-touchstone.js"></script>

The library will be injected in lightmill.convertTouchstone.

Usage

lightmill-convert-touchstone <input-file>

Or (if you do not need to install it and prefer to use npx):

npx @lightmill/convert-touchstone <input-file>

API

Param Type Default Description
touchStoneXML String | stream.Readable The XML to parse.
[options] object Options
[options.preBlocks] string | object | array | function The type of the task to insert before each block or a function to map the block values to task(s).
[options.postBlocks] string | object | array | function The type of the task to insert after each block or a function to map the block values to task(s).
[options.preRuns] string | object | array | function The type of the task to insert before each run or a function to map the run values to task(s).
[options.postRuns] string | object | array | function The type of the task to insert after each run or a function to map the run values to task(s).
[options.trials] string | object | array | function "trial" The type of the task to insert for each trial or a function to map the trial values to task(s).

Example

// Map each run to a task to insert before the trials of the run.
const preRuns = (run, experiment) => ({
  ...run,
  type: 'pre-run'
});
// Mappers can also be strings...
const postRuns = 'post-run';  // This is the same as above.
// ...arrays (if several tasks need to be inserted)...
const preBlocks = [
  { type: 'pre-block-1' },
  { type: 'pre-block-2' }
];
// ...or functions that returns arrays.
const postBlocks = (block, run, experiment) => [
  { type: 'post-block-1', runId: run.id },
  { ...block , type: 'post-block-2' }
  'post-block-2' // This is the same as above.
];
convertTouchStone(data, { preBlocks, postBlocks, postRuns, preRuns })
  .then(doSomething);

Current Tags

  • 3.0.0-alpha.6                                ...           latest (2 years ago)

6 Versions

  • 3.0.0-alpha.6                                ...           2 years ago
  • 3.0.0-alpha.5                                ...           2 years ago
  • 3.0.0-alpha.4                                ...           2 years ago
  • 3.0.0-alpha.3 [deprecated]           ...           2 years ago
  • 3.0.0-alpha.2                                ...           2 years ago
  • 3.0.0-alpha.1                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |