How to use the fontoxpath.evaluateXPathToArray function in fontoxpath

To help you get started, we’ve selected a few fontoxpath 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 FontoXML / fontoxpath / test / specs / parsing / arrays / arrayFunctions.tests.ts View on Github external
it('returns the full array if the range is full', () =>
			chai.assert.deepEqual(
				evaluateXPathToArray('array:subarray([1,2,3], 1, 3)', documentNode),
				[1, 2, 3]
			));
github FontoXML / fontoxpath / test / specs / parsing / arrays / ArrayConstructor.tests.ts View on Github external
it('can be parsed', () =>
			chai.assert.isOk(
				evaluateXPathToArray('array {1, 2}', documentNode),
				'It should be able to be parsed'
			));
		it('can be filled async', async () => {
github FontoXML / fontoxpath / test / specs / parsing / arrays / arrayFunctions.tests.ts View on Github external
it('appends an item to an empty array', () =>
			chai.assert.deepEqual(evaluateXPathToArray('array:append([], 0)', documentNode), [0]));
github FontoXML / fontoxpath / test / specs / parsing / VarRef.tests.ts View on Github external
it('can read a map value twice from within a function', () =>
			chai.assert.deepEqual(
				evaluateXPathToArray(
					`declare function local:func($some-map) {
						[$some-map("k"), $some-map("k")]
					};
					local:func($my-map)`,
					null,
					null,
					{ 'my-map': { k: 'val' } },
					{ language: evaluateXPath.XQUERY_3_1_LANGUAGE }
				),
				['val', 'val']
			));
github FontoXML / fontoxpath / test / specs / parsing / arrays / ArrayConstructor.tests.js View on Github external
			() => chai.assert.isOk(evaluateXPathToArray('array {1, 2}', documentNode)), 'It should be able to be parsed');
		it('can be filled async', async () => {
github FontoXML / fontoxpath / test / specs / parsing / arrays / arrayFunctions.tests.ts View on Github external
it('inserts before the last item', () =>
			chai.assert.deepEqual(
				evaluateXPathToArray('array:insert-before([1,2,3], 3, "a")', documentNode),
				[1, 2, 'a', 3]
			));
github FontoXML / fontoxpath / test / specs / parsing / arrays / arrayFunctions.tests.ts View on Github external
it('returns the result of calling the function for each item', () =>
			chai.assert.deepEqual(
				evaluateXPathToArray(
					'array:for-each([("the cat"),"sat",("on the mat")], function ($x) { tokenize($x) => reverse() => string-join(" ")})',
					documentNode
				),
				['cat the', 'sat', 'mat the on']
			));
github FontoXML / fontoxpath / test / specs / parsing / arrays / arrayFunctions.tests.ts View on Github external
it('inserts before the first item', () =>
			chai.assert.deepEqual(
				evaluateXPathToArray('array:insert-before([1,2,3], 1, "a")', documentNode),
				['a', 1, 2, 3]
			));
github FontoXML / fontoxpath / test / specs / parsing / arrays / arrayFunctions.tests.ts View on Github external
it('sorts the array', () =>
			chai.assert.deepEqual(evaluateXPathToArray('array:sort([3,2,1])', documentNode), [
				1,
				2,
				3
			]));
github FontoXML / fontoxpath / test / specs / parsing / arrays / arrayFunctions.tests.ts View on Github external
				() => evaluateXPathToArray('array:put([1,2,3], 0, "a")', documentNode),
				'FOAY0001'