Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

datom

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datom - npm Package Compare versions

Comparing version 6.3.0 to 7.0.0

47

lib/main.js

@@ -325,5 +325,4 @@ (function() {

this.settings = Object.assign(this.settings, this._defaults);
if ((base = this.settings).DATOM == null) {
base.DATOM = module.exports;
}
this.DATOM = (base = this.settings).DATOM != null ? base.DATOM : base.DATOM = module.exports;
delete this.settings.DATOM;
}

@@ -347,9 +346,11 @@

case /* NOTE always leave as-is, expanded by Cupofjoe */'text':
content.push(this.settings.DATOM.new_single_datom('text', {
text: part
content.push(this.DATOM.new_single_datom('text', {
text: part,
$: '^ð1^'
}));
break;
default:
content.push(this.settings.DATOM.new_single_datom('value', {
$value: part
content.push(this.DATOM.new_single_datom('value', {
$value: part,
$: '^ð2^'
}));

@@ -362,4 +363,9 @@ }

//---------------------------------------------------------------------------------------------------------
_cram(...P) {
return super.cram(...P);
}
//---------------------------------------------------------------------------------------------------------
cram(name, ...tail) {
var attributes, content, d1, has_attributes, v;
var attributes, content, d1, d2, has_attributes, v;
// XXX_SUPER = @Cupofjoe.

@@ -384,14 +390,28 @@ ({name, attributes, content} = this._analyze(name, tail));

if (has_attributes) {
d1 = this.settings.DATOM.new_open_datom(name, attributes);
d1 = this.DATOM.new_open_datom(name, attributes, {
$: '^ð3^'
});
d2 = this.DATOM.new_close_datom(name, attributes, {
$: '^ð4^'
});
} else {
d1 = this.settings.DATOM.new_open_datom(name);
d1 = this.DATOM.new_open_datom(name, {
$: '^ð5^'
});
d2 = this.DATOM.new_close_datom(name, {
$: '^ð6^'
});
}
return super.cram(d1, ...content, this.settings.DATOM.new_close_datom(name));
return super.cram(d1, ...content, d2);
}
//.......................................................................................................
if (has_attributes) {
return super.cram(this.settings.DATOM.new_single_datom(name, attributes));
return super.cram(this.DATOM.new_single_datom(name, attributes, {
$: '^ð7^'
}));
}
if (name !== null) {
return super.cram(this.settings.DATOM.new_single_datom(name));
return super.cram(this.DATOM.new_single_datom(name, {
$: '^ð8^'
}));
}

@@ -405,3 +425,2 @@ return null;

flatten: true,
absorb: true,
DATOM: null

@@ -408,0 +427,0 @@ };

{
"name": "datom",
"version": "6.3.0",
"version": "7.0.0",
"description": "standardized immutable objects in the spirit of datomic, especially suited for use in data pipelines",

@@ -5,0 +5,0 @@ "main": "lib/main.js",

@@ -433,3 +433,5 @@

* as with `Cupofjoe`, functions will be called, may either call `cram()` method or return value
* also possible to provide objects whose members will become attributes of the respective datom:
* return values will *not* be further analyzed but be kept as-is in the list returned by `expand()`
* also possible to provide (in non-initial positions) objects whose members will become attributes of the
respective datom:

@@ -440,4 +442,4 @@ ```coffee

c.cram 'greeting', '早安', { lang: 'zh_CN', }
c.cram { $key: '^greeting', lang: 'zh_CN', 问候: '早安', time_of_day: 'morning', }
c.cram { $key: '^text', lang: 'hi', text: 'नमस्ते', }
c.cram 'greeting', { lang: 'zh_CN', 问候: '早安', time_of_day: 'morning', }
c.cram 'text', { lang: 'hi', text: 'नमस्ते', }
c.cram 'greeting', ->

@@ -468,7 +470,2 @@ c.cram 'language', { $value: 'Japanese', }

* if first argument is an object, it is taken as 'template' for the datom
* this is only available when `Cupofdatom` has been instantiated with `{ absorb: true, }` (the default)
* no content may appear together with a template in the same `cram()` call
* the template *must* have a valid datom `$key` attribute
Call patterns:

@@ -478,5 +475,5 @@

* the **basic name** (the `$key` of the datom minus the sigil) of the datom,
* or else the **extended name**, where implemented (for example in InterText `CupOfHtml`, this means one
can give `div#c59.draggable.hilite` as first argument to produce elements with a tag name (`div`), an ID
(`c59`), and HTML `class` attribute (`draggable hilite`) in one go
* or else the **comprehensive name**, where implemented (for example in InterText `CupOfHtml`, this means
one can give `div#c59.draggable.hilite` as first argument to produce elements with a tag name (`div`),
an ID (`c59`), and HTML `class` attribute (`draggable hilite`) in one go
* or else **`null`** to indicate absence of a specific name

@@ -487,18 +484,18 @@ * when a name has been given

* in case no content has been given, a single `{ $key: '^name', }` datom will be produced
* of second and following arguments,
* if the instance has been set to `{ absorb: true, }` and the second argument is an object, then the
second argument—and only the second one—is treated as an attributes arguments to the datom that is to be
produced (similar to how `DATOM.new_datom()` works), so `cram 'foo', { id: 'c221', frob: true, }` will
produce `{ $key: '^foo', id: 'c221', frob: true, }`.
* In case a key/value pair attributes argument conflicts with one set by an extended name (as in `cram
'foo#IDA', { id: 'IDB', }`), the one in the attributes argument wins (as it would in a similar
situation when using `Object.assign()`)
* in case a content argument is a function, that function will be called without arguments.
* if the function itself calls `cram()` from the same instance, its return value will be discarded;
* as for arguments in non-initial positions:
* objects will be merged with `Object.assign()` and passed on to `DATOM.new_datom()`, so `cram 'foo', {
id: 'c221', frob: true, x: 1, }, ... { x: 2, }` will produce `{ $key: '^foo', id: 'c221', frob: true, x:
2, }`.
* In case a key/value pair attributes argument conflicts with one set by an comprehensive name (as in
`cram 'foo#IDA', { id: 'IDB', }`), the one in the attributes argument wins (as it would in a similar
situation when using `Object.assign()`)
* functions will be called without arguments
* if a function itself calls `cram()` from the same instance, its return value will be discarded;
* in case it does not call `cram()`, its return value will be discarded if it is `null` or `undefined`,
and otherwise become a content argument.
* in the base implemention, content arguments produce a series of 'value datoms'; e.g. `cram null, 42,
'some text', true` will emit `{ $key: '^value', $value: 42, }, { $key: '^value', $value: 'some text', },
{ $key: '^value', $value: true, }`
* derivatives may emit other datoms for calls with `null`, e.g. `CupOfHtml` will produce `^text` datoms
and otherwise become a content argument *without being processed*, so contained functions will not be
called and text values will not be wrapped in `{ $key: '^text', }` datoms
* texts will be wrapped in `{ $key: '^text', 'text': ..., }` datoms
* other values will be wrapped in `{ $key: '^value', '$value': ..., }` datoms, e.g. `cram null, 42, 'some
text', true` will emit `{ $key: '^value', $value: 42, }, { $key: '^text', $text: 'some text', }, { $key:
'^value', $value: true, }`

@@ -513,5 +510,3 @@ ```coffee

> **TAINT** should content inserted via return value be subject to same process as `cram()`med content?
# To Do

@@ -518,0 +513,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc