Skip to content
This repository was archived by the owner on Dec 19, 2022. It is now read-only.
This repository was archived by the owner on Dec 19, 2022. It is now read-only.

Support key matching #44

@AndersDJohnson

Description

@AndersDJohnson

It might be useful to support matching on keys, e.g. wildcards, regular expressions, etc., sort of like JSON Schema's patternProperties:

var s = require('strummer');

var person = s({
  '/.*Name/': 'string',
  'posts': {
    '*': 'boolean'
  }
});

console.log(person.match(bob));

would match:

{
  firstName: 'Anders',
  lastName: 'Johnson',
  posts: {
    '123': true,
    '456': true
  }
}

Then I could validate responses from an API like the above which includes dynamically generated IDs as keys of a relationships object in the format of Ember.js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions