Sha256: 69c211bb24d7c79ce8e6401f65ea0f0d396065efba19d891d4289d2c973ceebf

Contents?: true

Size: 1.19 KB

Versions: 46

Compression:

Stored size: 1.19 KB

Contents

"use strict";

module.exports = function (t, a) {
	var fn = function (raz, dwa) {
		return raz + dwa;
	};
	a(t("undefined"), undefined, "Undefined");
	a(t("null"), null, "Null");
	a(t("\"raz\""), "raz", "String");
	a(t("\"raz\\\"ddwa\\ntrzy\""), "raz\"ddwa\ntrzy", "String with escape");
	a(t("false"), false, "Booelean");
	a(String(t(String(fn))), String(fn), "Function");

	a.deep(t("/raz-dwa/g"), /raz-dwa/g, "RegExp");
	a.deep(t("new Date(1234567)"), new Date(1234567), "Date");
	a.deep(t("[]"), [], "Empty array");
	a.deep(
		t("[undefined,false,null,\"raz\\\"ddwa\\ntrzy\",/raz/g,new Date(1234567),[\"foo\"]]"),
		[undefined, false, null, "raz\"ddwa\ntrzy", /raz/g, new Date(1234567), ["foo"]],
		"Rich Array"
	);
	a.deep(t("{}"), {}, "Empty object");
	a.deep(
		t(
			"{\"raz\":undefined,\"dwa\":false,\"trzy\":null,\"cztery\":\"raz\\\"ddwa\\ntrzy\"," +
				"\"szesc\":/raz/g,\"siedem\":new Date(1234567),\"osiem\":[\"foo\",32]," +
				"\"dziewiec\":{\"foo\":\"bar\",\"dwa\":343}}"
		),
		{
			raz: undefined,
			dwa: false,
			trzy: null,
			cztery: "raz\"ddwa\ntrzy",
			szesc: /raz/g,
			siedem: new Date(1234567),
			osiem: ["foo", 32],
			dziewiec: { foo: "bar", dwa: 343 }
		},
		"Rich object"
	);
};

Version data entries

46 entries across 46 versions & 3 rubygems

Version Path
govuk_publishing_components-18.0.0 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.21.0 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.20.0 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.19.1 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.19.0 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.18.0 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.17.0 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.16.0 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.15.0 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.14.0 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.13.0 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.12.2 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.12.1 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.12.0 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.11.0 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.10.0 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.9.0 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.8.0 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.7.0 node_modules/es5-ext/test/object/unserialize.js
govuk_publishing_components-17.6.1 node_modules/es5-ext/test/object/unserialize.js