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

extendable-immutable

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extendable-immutable - npm Package Compare versions

Comparing version 1.0.13 to 1.1.0

24

es/extendable.js

@@ -1,11 +0,23 @@

import _Object$assign from 'babel-runtime/core-js/object/assign';
import _getIterator from 'babel-runtime/core-js/get-iterator';
import _Object$keys from 'babel-runtime/core-js/object/keys';
import _Object$assign from "babel-runtime/core-js/object/assign";
import _getIterator from "babel-runtime/core-js/get-iterator";
import _Object$keys from "babel-runtime/core-js/object/keys";
import createExtendable from './util/createExtendable';
export default function extendable(Base) {
var NAME = Base.prototype.constructor.name;
var emptyBase = new Base();
var NAME = Base.prototype.constructor.name;
var EMPTY = _Object$keys(new Base()).reduce(function (acc, key) {
var exampleBase = void 0;
if (emptyBase.add) {
exampleBase = emptyBase.add("a");
} else if (emptyBase.set) {
exampleBase = emptyBase.set("a", "b");
} else if (emptyBase.push) {
exampleBase = emptyBase.push("a");
} else {
throw new Error("extendable: `" + NAME + "` is not supported.");
}
var KEYS = _Object$keys(exampleBase);
var EMPTY = KEYS.reduce(function (acc, key) {
acc[key] = emptyBase[key];

@@ -16,3 +28,3 @@ return acc;

function copy(val, update) {
for (var _iterator = _Object$keys(update), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) {
for (var _iterator = KEYS, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) {
var _ref;

@@ -19,0 +31,0 @@

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -7,11 +7,11 @@ Object.defineProperty(exports, "__esModule", {

var _assign = require('babel-runtime/core-js/object/assign');
var _assign = require("babel-runtime/core-js/object/assign");
var _assign2 = _interopRequireDefault(_assign);
var _getIterator2 = require('babel-runtime/core-js/get-iterator');
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
var _getIterator3 = _interopRequireDefault(_getIterator2);
var _keys = require('babel-runtime/core-js/object/keys');
var _keys = require("babel-runtime/core-js/object/keys");

@@ -22,3 +22,3 @@ var _keys2 = _interopRequireDefault(_keys);

var _createExtendable = require('./util/createExtendable');
var _createExtendable = require("./util/createExtendable");

@@ -30,6 +30,18 @@ var _createExtendable2 = _interopRequireDefault(_createExtendable);

function extendable(Base) {
var NAME = Base.prototype.constructor.name;
var emptyBase = new Base();
var NAME = Base.prototype.constructor.name;
var EMPTY = (0, _keys2.default)(new Base()).reduce(function (acc, key) {
var exampleBase = void 0;
if (emptyBase.add) {
exampleBase = emptyBase.add("a");
} else if (emptyBase.set) {
exampleBase = emptyBase.set("a", "b");
} else if (emptyBase.push) {
exampleBase = emptyBase.push("a");
} else {
throw new Error("extendable: `" + NAME + "` is not supported.");
}
var KEYS = (0, _keys2.default)(exampleBase);
var EMPTY = KEYS.reduce(function (acc, key) {
acc[key] = emptyBase[key];

@@ -40,3 +52,3 @@ return acc;

function copy(val, update) {
for (var _iterator = (0, _keys2.default)(update), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
for (var _iterator = KEYS, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
var _ref;

@@ -43,0 +55,0 @@

{
"name": "extendable-immutable",
"version": "1.0.13",
"version": "1.1.0",
"main": "lib/index.js",

@@ -5,0 +5,0 @@ "jsnext:main": "es/index.js",

import createExtendable from './util/createExtendable'
export default function extendable(Base) {
const NAME = Base.prototype.constructor.name
const emptyBase = new Base()
const NAME = Base.prototype.constructor.name
const EMPTY = Object
.keys(new Base())
.reduce((acc, key) => {
acc[key] = emptyBase[key]
return acc
}, {})
let exampleBase
if (emptyBase.add) {
exampleBase = emptyBase.add("a")
} else if (emptyBase.set) {
exampleBase = emptyBase.set("a", "b")
} else if (emptyBase.push) {
exampleBase = emptyBase.push("a")
} else {
throw new Error(`extendable: \`${NAME}\` is not supported.`)
}
const KEYS = Object.keys(exampleBase)
const EMPTY = KEYS.reduce((acc, key) => {
acc[key] = emptyBase[key]
return acc
}, {})
function copy(val, update) {
for (const key of Object.keys(update)) {
for (const key of KEYS) {
val[key] = update[key]

@@ -17,0 +27,0 @@ }

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