Volker Mische (@vmische)
LXJS 2012 Lisbon
var lens = new CopyLens(/\d/);
var lens = new CopyLens(/\d/);
lens.get('2')
var lens = new CopyLens(/\d/);
lens.get('2').result === '2';
var lens = new CopyLens(/\d/);
lens.get('2').result === '2';
lens.create('5')
var lens = new CopyLens(/\d/);
lens.get('2').result === '2';
lens.create('5').result === '5';
var lens = new CopyLens(/\d/);
lens.get('2').result === '2';
lens.create('5').result === '5';
lens.put('5', )
var lens = new CopyLens(/\d/);
lens.get('2').result === '2';
lens.create('5').result === '5';
lens.put('5', '2')
var lens = new CopyLens(/\d/);
lens.get('2').result === '2';
lens.create('5').result === '5';
lens.put('5', '2').result === '5';
var lens = new DefaultLens(/\d/);
var lens = new DefaultLens(/\d/, 'js');
var lens = new DefaultLens(/\d/, 'js');
lens.get('2')
var lens = new DefaultLens(/\d/, 'js');
lens.get('2').result === 'js';
var lens = new DefaultLens(/\d/, 'js');
lens.get('2').result === 'js';
lens.put('js', '2')
var lens = new DefaultLens(/\d/, 'js');
lens.get('2').result === 'js';
lens.put('js', '2').result === '2';
var lens = new DefaultLens(/\d/, 'js');
lens.get('2').result === 'js';
lens.create('js')
lens.put('js', '2').result === '2';
var lens = new DefaultLens(/\d/, 'js', '0');
lens.get('2').result === 'js';
lens.create('js')
lens.put('js', '2').result === '2';
var lens = new DefaultLens(/\d/, 'js', '0');
lens.get('2').result === 'js';
lens.create('js').result === '0';
lens.put('js', '2').result === '2';
new DelLens(/\d/);
new DelLens(/\d/, '0');
new DelLens(/\d/, '0');
new InsLens('abc');
// Concatenation
new ConcatLens([any-number-of-lenses])
// Concatenation
new ConcatLens([any-number-of-lenses])
// Logical or
new UnionLens([any-number-of-lenses])
// Concatenation
new ConcatLens([any-number-of-lenses])
// Logical or
new UnionLens([any-number-of-lenses])
// One or more occurences
new KleeneLens(single-lens)
{"type": "Point", "coordinates": [10, 20]} → POINT(10 20)
// We want to match: "some-key": some-value
// We want to match: "some-key": some-value
var json_kv = function(key, lens) {
};
// We want to match: "some-key": some-value
var json_kv = function(key, lens) {
var key = '"' + key + '"';
};
// We want to match: "some-key": some-value
var json_kv = function(key, lens) {
var key = '"' + key + '"';
new DelLens()
]);
};
// We want to match: "some-key": some-value
var json_kv = function(key, lens) {
var key = '"' + key + '"';
new DelLens(new RegExp(key + ': '))
]);
};
// We want to match: "some-key": some-value
var json_kv = function(key, lens) {
var key = '"' + key + '"';
new DelLens(new RegExp(key + ': '), key + ': ')
};
// We want to match: "some-key": some-value
var json_kv = function(key, lens) {
var key = '"' + key + '"';
new DelLens(new RegExp(key + ': '), key + ': ')
lens
};
// We want to match: "some-key": some-value
var json_kv = function(key, lens) {
var key = '"' + key + '"';
new ConcatLens([
new DelLens(new RegExp(key + ': '), key + ': '),
lens
]);
};
// We want to match: "some-key": some-value
var json_kv = function(key, lens) {
var key = '"' + key + '"';
return new ConcatLens([
new DelLens(new RegExp(key + ': '), key + ': '),
lens
]);
};
{"type": "Point", "coordinates": [10, 20]} → POINT(10 20)