JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 316
  • Score
    100M100P100Q91642F
  • License unlicense

For each comma-separated key in object create a separate property.

Package Exports

  • split-keys

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (split-keys) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Split Keys Build Status

Gracefully declare properties aliases within objects. Split-keys splits comma-separated keys in object and for each key creates property alias.

Before:

var a = {
    x: {
        a: 1,
        b: 1
    }
};

//create alias
a.y = a.x;

After:

//declare list of aliases
var a = splitKeys({
    'x, y': {
        a: 1,
        b: 1
    }
});

Use

$ npm install split-keys

var splitKeys = require('split-keys');

var obj = splitKeys({
    'a, b': function(){}
});

obj.a === obj.b //true

API

  • splitKeys(object) — split comma-separated properties

  • splitKeys(object, deep) — split comma-separated properties, including inner objects

  • splitKeys(object, separator) — apply custom separator to split. Separator can be whether a string or a RegExp.

  • splitKeys(object, separator, deep) or splitKeys(object, deep, separator) — apply custom separator to deep split keys

NPM