Compare commits
1 Commits
v13.0.0-28
...
v13.0.0-27
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbe2abafbb |
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "13.0.0-28",
|
"version": "13.0.0-27",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "13.0.0-28",
|
"version": "13.0.0-27",
|
||||||
"description": "A framework for real-time p2p shared editing on any data",
|
"description": "A framework for real-time p2p shared editing on any data",
|
||||||
"main": "./y.node.js",
|
"main": "./y.node.js",
|
||||||
"browser": "./y.js",
|
"browser": "./y.js",
|
||||||
|
|||||||
@@ -20,13 +20,7 @@ export default class ItemJSON extends Item {
|
|||||||
this._content = new Array(len)
|
this._content = new Array(len)
|
||||||
for (let i = 0; i < len; i++) {
|
for (let i = 0; i < len; i++) {
|
||||||
const ctnt = decoder.readVarString()
|
const ctnt = decoder.readVarString()
|
||||||
let parsed
|
this._content[i] = JSON.parse(ctnt)
|
||||||
if (ctnt === 'undefined') {
|
|
||||||
parsed = undefined
|
|
||||||
} else {
|
|
||||||
parsed = JSON.parse(ctnt)
|
|
||||||
}
|
|
||||||
this._content[i] = parsed
|
|
||||||
}
|
}
|
||||||
return missing
|
return missing
|
||||||
}
|
}
|
||||||
@@ -35,14 +29,7 @@ export default class ItemJSON extends Item {
|
|||||||
let len = this._content.length
|
let len = this._content.length
|
||||||
encoder.writeVarUint(len)
|
encoder.writeVarUint(len)
|
||||||
for (let i = 0; i < len; i++) {
|
for (let i = 0; i < len; i++) {
|
||||||
let encoded
|
encoder.writeVarString(JSON.stringify(this._content[i]))
|
||||||
let content = this._content[i]
|
|
||||||
if (content === undefined) {
|
|
||||||
encoded = 'undefined'
|
|
||||||
} else {
|
|
||||||
encoded = JSON.stringify(content)
|
|
||||||
}
|
|
||||||
encoder.writeVarString(encoded)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_logString () {
|
_logString () {
|
||||||
|
|||||||
@@ -136,26 +136,6 @@ export function applyChangesFromDom (dom) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function reflectChangesOnDom (events) {
|
export function reflectChangesOnDom (events) {
|
||||||
// Make sure that no filtered attributes are applied to the structure
|
|
||||||
// if they were, delete them
|
|
||||||
events.forEach(event => {
|
|
||||||
const target = event.target
|
|
||||||
const keys = this._domFilter(target.nodeName, Array.from(event.keysChanged))
|
|
||||||
if (keys === null) {
|
|
||||||
target._delete()
|
|
||||||
} else {
|
|
||||||
const removeKeys = new Set() // is a copy of event.keysChanged
|
|
||||||
event.keysChanged.forEach(key => { removeKeys.add(key) })
|
|
||||||
keys.forEach(key => {
|
|
||||||
// remove all accepted keys from removeKeys
|
|
||||||
removeKeys.delete(key)
|
|
||||||
})
|
|
||||||
// remove the filtered attribute
|
|
||||||
removeKeys.forEach(key => {
|
|
||||||
target.removeAttribute(key)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this._mutualExclude(() => {
|
this._mutualExclude(() => {
|
||||||
events.forEach(event => {
|
events.forEach(event => {
|
||||||
const yxml = event.target
|
const yxml = event.target
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ test('basic map tests', async function map0 (t) {
|
|||||||
test('Basic get&set of Map property (converge via sync)', async function map1 (t) {
|
test('Basic get&set of Map property (converge via sync)', async function map1 (t) {
|
||||||
let { users, map0 } = await initArrays(t, { users: 2 })
|
let { users, map0 } = await initArrays(t, { users: 2 })
|
||||||
map0.set('stuff', 'stuffy')
|
map0.set('stuff', 'stuffy')
|
||||||
map0.set('undefined', undefined)
|
|
||||||
map0.set('null', null)
|
|
||||||
t.compare(map0.get('stuff'), 'stuffy')
|
t.compare(map0.get('stuff'), 'stuffy')
|
||||||
|
|
||||||
await flushAll(t, users)
|
await flushAll(t, users)
|
||||||
@@ -50,8 +48,6 @@ test('Basic get&set of Map property (converge via sync)', async function map1 (t
|
|||||||
for (let user of users) {
|
for (let user of users) {
|
||||||
var u = user.get('map', Y.Map)
|
var u = user.get('map', Y.Map)
|
||||||
t.compare(u.get('stuff'), 'stuffy')
|
t.compare(u.get('stuff'), 'stuffy')
|
||||||
t.assert(u.get('undefined') === undefined, 'undefined')
|
|
||||||
t.compare(u.get('null'), null, 'null')
|
|
||||||
}
|
}
|
||||||
await compareUsers(t, users)
|
await compareUsers(t, users)
|
||||||
})
|
})
|
||||||
|
|||||||
39
y.node.js
39
y.node.js
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* yjs - A framework for real-time p2p shared editing on any data
|
* yjs - A framework for real-time p2p shared editing on any data
|
||||||
* @version v13.0.0-28
|
* @version v13.0.0-27
|
||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -2091,13 +2091,7 @@ class ItemJSON extends Item {
|
|||||||
this._content = new Array(len);
|
this._content = new Array(len);
|
||||||
for (let i = 0; i < len; i++) {
|
for (let i = 0; i < len; i++) {
|
||||||
const ctnt = decoder.readVarString();
|
const ctnt = decoder.readVarString();
|
||||||
let parsed;
|
this._content[i] = JSON.parse(ctnt);
|
||||||
if (ctnt === 'undefined') {
|
|
||||||
parsed = undefined;
|
|
||||||
} else {
|
|
||||||
parsed = JSON.parse(ctnt);
|
|
||||||
}
|
|
||||||
this._content[i] = parsed;
|
|
||||||
}
|
}
|
||||||
return missing
|
return missing
|
||||||
}
|
}
|
||||||
@@ -2106,14 +2100,7 @@ class ItemJSON extends Item {
|
|||||||
let len = this._content.length;
|
let len = this._content.length;
|
||||||
encoder.writeVarUint(len);
|
encoder.writeVarUint(len);
|
||||||
for (let i = 0; i < len; i++) {
|
for (let i = 0; i < len; i++) {
|
||||||
let encoded;
|
encoder.writeVarString(JSON.stringify(this._content[i]));
|
||||||
let content = this._content[i];
|
|
||||||
if (content === undefined) {
|
|
||||||
encoded = 'undefined';
|
|
||||||
} else {
|
|
||||||
encoded = JSON.stringify(content);
|
|
||||||
}
|
|
||||||
encoder.writeVarString(encoded);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_logString () {
|
_logString () {
|
||||||
@@ -2777,26 +2764,6 @@ function applyChangesFromDom (dom) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reflectChangesOnDom (events) {
|
function reflectChangesOnDom (events) {
|
||||||
// Make sure that no filtered attributes are applied to the structure
|
|
||||||
// if they were, delete them
|
|
||||||
events.forEach(event => {
|
|
||||||
const target = event.target;
|
|
||||||
const keys = this._domFilter(target.nodeName, Array.from(event.keysChanged));
|
|
||||||
if (keys === null) {
|
|
||||||
target._delete();
|
|
||||||
} else {
|
|
||||||
const removeKeys = new Set(); // is a copy of event.keysChanged
|
|
||||||
event.keysChanged.forEach(key => { removeKeys.add(key); });
|
|
||||||
keys.forEach(key => {
|
|
||||||
// remove all accepted keys from removeKeys
|
|
||||||
removeKeys.delete(key);
|
|
||||||
});
|
|
||||||
// remove the filtered attribute
|
|
||||||
removeKeys.forEach(key => {
|
|
||||||
target.removeAttribute(key);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this._mutualExclude(() => {
|
this._mutualExclude(() => {
|
||||||
events.forEach(event => {
|
events.forEach(event => {
|
||||||
const yxml = event.target;
|
const yxml = event.target;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
214
y.test.js
214
y.test.js
@@ -1,8 +1,8 @@
|
|||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
|
||||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
typeof define === 'function' && define.amd ? define(factory) :
|
||||||
(factory((global['y-tests'] = {})));
|
(factory());
|
||||||
}(this, (function (exports) { 'use strict';
|
}(this, (function () { 'use strict';
|
||||||
|
|
||||||
class N {
|
class N {
|
||||||
// A created node is always red!
|
// A created node is always red!
|
||||||
@@ -1448,10 +1448,6 @@ function logID (id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete all items in an ID-range
|
|
||||||
* TODO: implement getItemCleanStartNode for better performance (only one lookup)
|
|
||||||
*/
|
|
||||||
function deleteItemRange (y, user, clock, range) {
|
function deleteItemRange (y, user, clock, range) {
|
||||||
const createDelete = y.connector._forwardAppliedStructs;
|
const createDelete = y.connector._forwardAppliedStructs;
|
||||||
let item = y.os.getItemCleanStart(new ID(user, clock));
|
let item = y.os.getItemCleanStart(new ID(user, clock));
|
||||||
@@ -1556,13 +1552,6 @@ function transactionTypeChanged (y, type, sub) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper utility to split an Item (see _splitAt)
|
|
||||||
* - copy all properties from a to b
|
|
||||||
* - connect a to b
|
|
||||||
* - assigns the correct _id
|
|
||||||
* - save b to os
|
|
||||||
*/
|
|
||||||
function splitHelper (y, a, b, diff) {
|
function splitHelper (y, a, b, diff) {
|
||||||
const aID = a._id;
|
const aID = a._id;
|
||||||
b._id = new ID(aID.user, aID.clock + diff);
|
b._id = new ID(aID.user, aID.clock + diff);
|
||||||
@@ -1913,7 +1902,6 @@ class EventHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// restructure children as if they were inserted one after another
|
|
||||||
function integrateChildren (y, start) {
|
function integrateChildren (y, start) {
|
||||||
let right;
|
let right;
|
||||||
do {
|
do {
|
||||||
@@ -2088,13 +2076,7 @@ class ItemJSON extends Item {
|
|||||||
this._content = new Array(len);
|
this._content = new Array(len);
|
||||||
for (let i = 0; i < len; i++) {
|
for (let i = 0; i < len; i++) {
|
||||||
const ctnt = decoder.readVarString();
|
const ctnt = decoder.readVarString();
|
||||||
let parsed;
|
this._content[i] = JSON.parse(ctnt);
|
||||||
if (ctnt === 'undefined') {
|
|
||||||
parsed = undefined;
|
|
||||||
} else {
|
|
||||||
parsed = JSON.parse(ctnt);
|
|
||||||
}
|
|
||||||
this._content[i] = parsed;
|
|
||||||
}
|
}
|
||||||
return missing
|
return missing
|
||||||
}
|
}
|
||||||
@@ -2103,14 +2085,7 @@ class ItemJSON extends Item {
|
|||||||
let len = this._content.length;
|
let len = this._content.length;
|
||||||
encoder.writeVarUint(len);
|
encoder.writeVarUint(len);
|
||||||
for (let i = 0; i < len; i++) {
|
for (let i = 0; i < len; i++) {
|
||||||
let encoded;
|
encoder.writeVarString(JSON.stringify(this._content[i]));
|
||||||
let content = this._content[i];
|
|
||||||
if (content === undefined) {
|
|
||||||
encoded = 'undefined';
|
|
||||||
} else {
|
|
||||||
encoded = JSON.stringify(content);
|
|
||||||
}
|
|
||||||
encoder.writeVarString(encoded);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_logString () {
|
_logString () {
|
||||||
@@ -2774,26 +2749,6 @@ function applyChangesFromDom (dom) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reflectChangesOnDom (events) {
|
function reflectChangesOnDom (events) {
|
||||||
// Make sure that no filtered attributes are applied to the structure
|
|
||||||
// if they were, delete them
|
|
||||||
events.forEach(event => {
|
|
||||||
const target = event.target;
|
|
||||||
const keys = this._domFilter(target.nodeName, Array.from(event.keysChanged));
|
|
||||||
if (keys === null) {
|
|
||||||
target._delete();
|
|
||||||
} else {
|
|
||||||
const removeKeys = new Set(); // is a copy of event.keysChanged
|
|
||||||
event.keysChanged.forEach(key => { removeKeys.add(key); });
|
|
||||||
keys.forEach(key => {
|
|
||||||
// remove all accepted keys from removeKeys
|
|
||||||
removeKeys.delete(key);
|
|
||||||
});
|
|
||||||
// remove the filtered attribute
|
|
||||||
removeKeys.forEach(key => {
|
|
||||||
target.removeAttribute(key);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this._mutualExclude(() => {
|
this._mutualExclude(() => {
|
||||||
events.forEach(event => {
|
events.forEach(event => {
|
||||||
const yxml = event.target;
|
const yxml = event.target;
|
||||||
@@ -4528,7 +4483,7 @@ var y = d * 365.25;
|
|||||||
* @api public
|
* @api public
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var ms = function(val, options) {
|
var index = function(val, options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
var type = typeof val;
|
var type = typeof val;
|
||||||
if (type === 'string' && val.length > 0) {
|
if (type === 'string' && val.length > 0) {
|
||||||
@@ -4670,7 +4625,7 @@ exports.coerce = coerce;
|
|||||||
exports.disable = disable;
|
exports.disable = disable;
|
||||||
exports.enable = enable;
|
exports.enable = enable;
|
||||||
exports.enabled = enabled;
|
exports.enabled = enabled;
|
||||||
exports.humanize = ms;
|
exports.humanize = index;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The currently active debug mode names, and names to skip.
|
* The currently active debug mode names, and names to skip.
|
||||||
@@ -4729,8 +4684,8 @@ function createDebug(namespace) {
|
|||||||
|
|
||||||
// set `diff` timestamp
|
// set `diff` timestamp
|
||||||
var curr = +new Date();
|
var curr = +new Date();
|
||||||
var ms$$1 = curr - (prevTime || curr);
|
var ms = curr - (prevTime || curr);
|
||||||
self.diff = ms$$1;
|
self.diff = ms;
|
||||||
self.prev = prevTime;
|
self.prev = prevTime;
|
||||||
self.curr = curr;
|
self.curr = curr;
|
||||||
prevTime = curr;
|
prevTime = curr;
|
||||||
@@ -4749,19 +4704,19 @@ function createDebug(namespace) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// apply any `formatters` transformations
|
// apply any `formatters` transformations
|
||||||
var index = 0;
|
var index$$1 = 0;
|
||||||
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
|
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
|
||||||
// if we encounter an escaped % then don't increase the array index
|
// if we encounter an escaped % then don't increase the array index
|
||||||
if (match === '%%') return match;
|
if (match === '%%') return match;
|
||||||
index++;
|
index$$1++;
|
||||||
var formatter = exports.formatters[format];
|
var formatter = exports.formatters[format];
|
||||||
if ('function' === typeof formatter) {
|
if ('function' === typeof formatter) {
|
||||||
var val = args[index];
|
var val = args[index$$1];
|
||||||
match = formatter.call(self, val);
|
match = formatter.call(self, val);
|
||||||
|
|
||||||
// now we need to remove `args[index]` since it's inlined in the `format`
|
// now we need to remove `args[index]` since it's inlined in the `format`
|
||||||
args.splice(index, 1);
|
args.splice(index$$1, 1);
|
||||||
index--;
|
index$$1--;
|
||||||
}
|
}
|
||||||
return match;
|
return match;
|
||||||
});
|
});
|
||||||
@@ -5727,7 +5682,7 @@ if (typeof Y !== 'undefined') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var chance_1 = createCommonjsModule(function (module, exports) {
|
var chance_1 = createCommonjsModule(function (module, exports) {
|
||||||
// Chance.js 1.0.12
|
// Chance.js 1.0.10
|
||||||
// http://chancejs.com
|
// http://chancejs.com
|
||||||
// (c) 2013 Victor Quinn
|
// (c) 2013 Victor Quinn
|
||||||
// Chance may be freely distributed or modified under the MIT license.
|
// Chance may be freely distributed or modified under the MIT license.
|
||||||
@@ -5792,7 +5747,7 @@ var chance_1 = createCommonjsModule(function (module, exports) {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Chance.prototype.VERSION = "1.0.12";
|
Chance.prototype.VERSION = "1.0.10";
|
||||||
|
|
||||||
// Random helper functions
|
// Random helper functions
|
||||||
function initOptions(options, defaults) {
|
function initOptions(options, defaults) {
|
||||||
@@ -6011,16 +5966,6 @@ var chance_1 = createCommonjsModule(function (module, exports) {
|
|||||||
return integer.toString(16);
|
return integer.toString(16);
|
||||||
};
|
};
|
||||||
|
|
||||||
Chance.prototype.letter = function(options) {
|
|
||||||
options = initOptions(options, {casing: 'lower'});
|
|
||||||
var pool = "abcdefghijklmnopqrstuvwxyz";
|
|
||||||
var letter = this.character({pool: pool});
|
|
||||||
if (options.casing === 'upper') {
|
|
||||||
letter = letter.toUpperCase();
|
|
||||||
}
|
|
||||||
return letter;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a random string
|
* Return a random string
|
||||||
*
|
*
|
||||||
@@ -6963,25 +6908,8 @@ var chance_1 = createCommonjsModule(function (module, exports) {
|
|||||||
return this.word({length: options.length}) + '@' + (options.domain || this.domain());
|
return this.word({length: options.length}) + '@' + (options.domain || this.domain());
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* #Description:
|
|
||||||
* ===============================================
|
|
||||||
* Generate a random Facebook id, aka fbid.
|
|
||||||
*
|
|
||||||
* NOTE: At the moment (Sep 2017), Facebook ids are
|
|
||||||
* "numeric strings" of length 16.
|
|
||||||
* However, Facebook Graph API documentation states that
|
|
||||||
* "it is extremely likely to change over time".
|
|
||||||
* @see https://developers.facebook.com/docs/graph-api/overview/
|
|
||||||
*
|
|
||||||
* #Examples:
|
|
||||||
* ===============================================
|
|
||||||
* chance.fbid() => '1000035231661304'
|
|
||||||
*
|
|
||||||
* @return [string] facebook id
|
|
||||||
*/
|
|
||||||
Chance.prototype.fbid = function () {
|
Chance.prototype.fbid = function () {
|
||||||
return '10000' + this.string({pool: "1234567890", length: 11});
|
return parseInt('10000' + this.natural({max: 100000000000}), 10);
|
||||||
};
|
};
|
||||||
|
|
||||||
Chance.prototype.google_analytics = function () {
|
Chance.prototype.google_analytics = function () {
|
||||||
@@ -7822,72 +7750,8 @@ var chance_1 = createCommonjsModule(function (module, exports) {
|
|||||||
|
|
||||||
// -- End Regional
|
// -- End Regional
|
||||||
|
|
||||||
// -- Music --
|
|
||||||
|
|
||||||
Chance.prototype.note = function(options) {
|
|
||||||
// choices for 'notes' option:
|
|
||||||
// flatKey - chromatic scale with flat notes (default)
|
|
||||||
// sharpKey - chromatic scale with sharp notes
|
|
||||||
// flats - just flat notes
|
|
||||||
// sharps - just sharp notes
|
|
||||||
// naturals - just natural notes
|
|
||||||
// all - naturals, sharps and flats
|
|
||||||
options = initOptions(options, { notes : 'flatKey'});
|
|
||||||
var scales = {
|
|
||||||
naturals: ['C', 'D', 'E', 'F', 'G', 'A', 'B'],
|
|
||||||
flats: ['D♭', 'E♭', 'G♭', 'A♭', 'B♭'],
|
|
||||||
sharps: ['C♯', 'D♯', 'F♯', 'G♯', 'A♯']
|
|
||||||
};
|
|
||||||
scales.all = scales.naturals.concat(scales.flats.concat(scales.sharps));
|
|
||||||
scales.flatKey = scales.naturals.concat(scales.flats);
|
|
||||||
scales.sharpKey = scales.naturals.concat(scales.sharps);
|
|
||||||
return this.pickone(scales[options.notes]);
|
|
||||||
};
|
|
||||||
|
|
||||||
Chance.prototype.midi_note = function(options) {
|
|
||||||
var min = 0;
|
|
||||||
var max = 127;
|
|
||||||
options = initOptions(options, { min : min, max : max });
|
|
||||||
return this.integer({min: options.min, max: options.max});
|
|
||||||
};
|
|
||||||
|
|
||||||
Chance.prototype.chord_quality = function(options) {
|
|
||||||
options = initOptions(options, { jazz: true });
|
|
||||||
var chord_qualities = ['maj', 'min', 'aug', 'dim'];
|
|
||||||
if (options.jazz){
|
|
||||||
chord_qualities = [
|
|
||||||
'maj7',
|
|
||||||
'min7',
|
|
||||||
'7',
|
|
||||||
'sus',
|
|
||||||
'dim',
|
|
||||||
'ø'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
return this.pickone(chord_qualities);
|
|
||||||
};
|
|
||||||
|
|
||||||
Chance.prototype.chord = function (options) {
|
|
||||||
options = initOptions(options);
|
|
||||||
return this.note(options) + this.chord_quality(options);
|
|
||||||
};
|
|
||||||
|
|
||||||
Chance.prototype.tempo = function (options) {
|
|
||||||
var min = 40;
|
|
||||||
var max = 320;
|
|
||||||
options = initOptions(options, {min: min, max: max});
|
|
||||||
return this.integer({min: options.min, max: options.max});
|
|
||||||
};
|
|
||||||
|
|
||||||
// -- End Music
|
|
||||||
|
|
||||||
// -- Miscellaneous --
|
// -- Miscellaneous --
|
||||||
|
|
||||||
// Coin - Flip, flip, flipadelphia
|
|
||||||
Chance.prototype.coin = function(options) {
|
|
||||||
return this.bool() ? "heads" : "tails";
|
|
||||||
};
|
|
||||||
|
|
||||||
// Dice - For all the board game geeks out there, myself included ;)
|
// Dice - For all the board game geeks out there, myself included ;)
|
||||||
function diceFn (range) {
|
function diceFn (range) {
|
||||||
return function () {
|
return function () {
|
||||||
@@ -13077,19 +12941,6 @@ var chance_1 = createCommonjsModule(function (module, exports) {
|
|||||||
|
|
||||||
var chance_2 = chance_1.Chance;
|
var chance_2 = chance_1.Chance;
|
||||||
|
|
||||||
/**
|
|
||||||
* Try to merge all items in os with their successors.
|
|
||||||
*
|
|
||||||
* Some transformations (like delete) fragment items.
|
|
||||||
* Item(c: 'ab') + Delete(1,1) + Delete(0, 1) -> Item(c: 'a',deleted);Item(c: 'b',deleted)
|
|
||||||
*
|
|
||||||
* This functions merges the fragmented nodes together:
|
|
||||||
* Item(c: 'a',deleted);Item(c: 'b',deleted) -> Item(c: 'ab', deleted)
|
|
||||||
*
|
|
||||||
* TODO: The Tree implementation does not support deletions in-spot.
|
|
||||||
* This is why all deletions must be performed after the traversal.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function defragmentItemContent (y) {
|
function defragmentItemContent (y) {
|
||||||
const os = y.os;
|
const os = y.os;
|
||||||
if (os.length < 2) {
|
if (os.length < 2) {
|
||||||
@@ -13368,7 +13219,7 @@ async function applyRandomTests (t, mods, iterations) {
|
|||||||
return initInformation
|
return initInformation
|
||||||
}
|
}
|
||||||
|
|
||||||
var index$1 = function (str) {
|
var index$1$1 = function (str) {
|
||||||
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
|
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
|
||||||
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
|
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
|
||||||
});
|
});
|
||||||
@@ -13554,7 +13405,7 @@ function parserForArrayFormat(opts) {
|
|||||||
|
|
||||||
function encode(value, opts) {
|
function encode(value, opts) {
|
||||||
if (opts.encode) {
|
if (opts.encode) {
|
||||||
return opts.strict ? index$1(value) : encodeURIComponent(value);
|
return opts.strict ? index$1$1(value) : encodeURIComponent(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
@@ -13666,7 +13517,7 @@ var stringify = function (obj, opts) {
|
|||||||
}).join('&') : '';
|
}).join('&') : '';
|
||||||
};
|
};
|
||||||
|
|
||||||
var index = {
|
var index$2 = {
|
||||||
extract: extract,
|
extract: extract,
|
||||||
parse: parse$1,
|
parse: parse$1,
|
||||||
stringify: stringify
|
stringify: stringify
|
||||||
@@ -13681,7 +13532,7 @@ const browserSupport =
|
|||||||
|
|
||||||
function createTestLink (params) {
|
function createTestLink (params) {
|
||||||
if (typeof location !== 'undefined') {
|
if (typeof location !== 'undefined') {
|
||||||
var query = index.parse(location.search);
|
var query = index$2.parse(location.search);
|
||||||
delete query.test;
|
delete query.test;
|
||||||
delete query.seed;
|
delete query.seed;
|
||||||
delete query.args;
|
delete query.args;
|
||||||
@@ -13691,7 +13542,7 @@ function createTestLink (params) {
|
|||||||
query[name] = params[name];
|
query[name] = params[name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return location.protocol + '//' + location.host + location.pathname + '?' + index.stringify(query) + location.hash
|
return location.protocol + '//' + location.host + location.pathname + '?' + index$2.stringify(query) + location.hash
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13702,7 +13553,7 @@ class TestHandler {
|
|||||||
this.repeatingRun = 0;
|
this.repeatingRun = 0;
|
||||||
this.tests = {};
|
this.tests = {};
|
||||||
if (typeof location !== 'undefined') {
|
if (typeof location !== 'undefined') {
|
||||||
this.opts = index.parse(location.search);
|
this.opts = index$2.parse(location.search);
|
||||||
if (this.opts.case != null) {
|
if (this.opts.case != null) {
|
||||||
this.opts.case = Number(this.opts.case);
|
this.opts.case = Number(this.opts.case);
|
||||||
}
|
}
|
||||||
@@ -13843,7 +13694,7 @@ function createCommonjsModule$1(fn, module) {
|
|||||||
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
||||||
}
|
}
|
||||||
|
|
||||||
var isBrowser = typeof index !== 'undefined';
|
var isBrowser = typeof index$2 !== 'undefined';
|
||||||
|
|
||||||
var environment = {
|
var environment = {
|
||||||
isBrowser: isBrowser
|
isBrowser: isBrowser
|
||||||
@@ -18392,8 +18243,8 @@ var stacktraceGps = createCommonjsModule$1(function (module, exports) {
|
|||||||
* @returns {String} original representation of the base64-encoded string.
|
* @returns {String} original representation of the base64-encoded string.
|
||||||
*/
|
*/
|
||||||
function _atob(b64str) {
|
function _atob(b64str) {
|
||||||
if (typeof index !== 'undefined' && index.atob) {
|
if (typeof index$2 !== 'undefined' && index$2.atob) {
|
||||||
return index.atob(b64str);
|
return index$2.atob(b64str);
|
||||||
} else {
|
} else {
|
||||||
throw new Error('You must supply a polyfill for window.atob in this environment');
|
throw new Error('You must supply a polyfill for window.atob in this environment');
|
||||||
}
|
}
|
||||||
@@ -18925,7 +18776,7 @@ function proxyConsole () {
|
|||||||
['log', 'error', 'assert'].map(createProxy);
|
['log', 'error', 'assert'].map(createProxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
index.stacktrace = stacktrace;
|
index$2.stacktrace = stacktrace;
|
||||||
|
|
||||||
function test (testDescription, ...args) {
|
function test (testDescription, ...args) {
|
||||||
let location = stacktrace.getSync()[1];
|
let location = stacktrace.getSync()[1];
|
||||||
@@ -18934,6 +18785,9 @@ function test (testDescription, ...args) {
|
|||||||
testHandler.register(testCase);
|
testHandler.register(testCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//# sourceMappingURL=cutest.mjs.map
|
||||||
|
|
||||||
proxyConsole();
|
proxyConsole();
|
||||||
|
|
||||||
test('basic map tests', async function map0 (t) {
|
test('basic map tests', async function map0 (t) {
|
||||||
@@ -18974,8 +18828,6 @@ test('basic map tests', async function map0 (t) {
|
|||||||
test('Basic get&set of Map property (converge via sync)', async function map1 (t) {
|
test('Basic get&set of Map property (converge via sync)', async function map1 (t) {
|
||||||
let { users, map0 } = await initArrays(t, { users: 2 });
|
let { users, map0 } = await initArrays(t, { users: 2 });
|
||||||
map0.set('stuff', 'stuffy');
|
map0.set('stuff', 'stuffy');
|
||||||
map0.set('undefined', undefined);
|
|
||||||
map0.set('null', null);
|
|
||||||
t.compare(map0.get('stuff'), 'stuffy');
|
t.compare(map0.get('stuff'), 'stuffy');
|
||||||
|
|
||||||
await flushAll(t, users);
|
await flushAll(t, users);
|
||||||
@@ -18983,8 +18835,6 @@ test('Basic get&set of Map property (converge via sync)', async function map1 (t
|
|||||||
for (let user of users) {
|
for (let user of users) {
|
||||||
var u = user.get('map', Y$1.Map);
|
var u = user.get('map', Y$1.Map);
|
||||||
t.compare(u.get('stuff'), 'stuffy');
|
t.compare(u.get('stuff'), 'stuffy');
|
||||||
t.assert(u.get('undefined') === undefined, 'undefined');
|
|
||||||
t.compare(u.get('null'), null, 'null');
|
|
||||||
}
|
}
|
||||||
await compareUsers(t, users);
|
await compareUsers(t, users);
|
||||||
});
|
});
|
||||||
@@ -19298,7 +19148,5 @@ test('y-map: Random tests (1800)', async function randomMap1800 (t) {
|
|||||||
await applyRandomTests(t, mapTransactions, 1800);
|
await applyRandomTests(t, mapTransactions, 1800);
|
||||||
});
|
});
|
||||||
|
|
||||||
Object.defineProperty(exports, '__esModule', { value: true });
|
|
||||||
|
|
||||||
})));
|
})));
|
||||||
//# sourceMappingURL=y.test.js.map
|
//# sourceMappingURL=y.test.js.map
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user