
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
ot-json1-immutable
Advanced tools
This module add supports for Immutable.js structures to ot-json1
.
yarn add ot-json1-immutable ot-json1 immutable
Just import json from ot-json1-immutable
and use it exactly like specified by ot-json1
documentation. Use applyImmutable
to actually apply operations to any immutable structure.
import json1 from 'ot-json1-immutable';
import { Map } from 'immutable';
const op = json1.moveOp(['a'], ['b']);
let doc = new Map({ a: 1 });
doc = json1.type.applyImmutable(doc, op);
// doc => new Map({ b: 1 })
applyImmutable
function also take a reviver, used by Immutable's fromJS
:
function reviver(key, value) => {
if (!isKeyed(value)) {
return value.toList();
}
switch (value.get('object')) {
case 'block':
return Block.create(value.toJS());
default:
return value.toMap();
}
}
const op = json1.insertOp(['a'], { object: 'block' });
let doc = new Map({});
doc = json1.type.applyImmutable(doc, op, reviver);
// doc.get('a') => new Block()
FAQs
Add Immutable.js support to ot-json1
The npm package ot-json1-immutable receives a total of 11 weekly downloads. As such, ot-json1-immutable popularity was classified as not popular.
We found that ot-json1-immutable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.