npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sl-ember-modelize

v1.5.0

Published

Provides the ability to turn a Plain Old Javascript Object (POJO) into a series of nested model objects.

Downloads

12

Readme

Latest Release Ember CLI version License Downloads

Dependencies Dev Dependencies

Build Status Code Climate

To see which issues are currently being worked on or are scheduled to be worked on next, visit https://huboard.com/softlayer/sl-ember-modelize/#/


What sl-ember-modelize is

A mixin that will take a Plain Old Javascript Object (POJO) and turn it into a series of nested model objects, based on the models registered in your application's container. This works for objects stored on keys and on arrays of objects stored on keys too. This mixin will:

  • Recursively resolve keys (via the container) on an object and check to see if a model exists that matches that key
  • Create models for keys and store the key's contents in those models

Demo

Live

http://softlayer.github.io/sl-ember-modelize/#/demo

Development Environment

Installation

  • git clone this repository
  • npm install
  • bower install

Running

  • ember server
  • View the demo at http://localhost:4200

For more information on using ember-cli, visit http://www.ember-cli.com/.


How to use this addon in your application

Install this addon as a Node module

ember install:addon sl-ember-modelize

Use the mixin

Include it in your objects like so:

import ModelizeMixin from 'sl-ember-modelize/mixins/modelize';

Ember.Object.extend( ModelizeMixin, {} );

You can now call modelize from within that object like so:

modelizedObj = this.modelize( POJO );

How it works

Consider this fixture:

fixture: {
    foo: {
        bar: {
            car: [
                {
                    name: 'car1',
                    color: 'blue'
                },
                {
                    name: 'car2',
                    color: 'red'
                },
                {
                    name: 'car3',
                    color: 'black'
                }
            ],
            test: 'this is a bar model'
        },
        text: 'this is a foo model'
    }
}

Passing this POJO through the modelize function will cause the object stored in the values for foo, bar, and the array stored on car to be replaced with the models defined for those key names in the app. Modelize looks up models via Ember's container and if a model is found then it is instantiated with the values from the fixture.


Versioning

Employs Semantic Versioning 2.0.0


Contribution

See CONTRIBUTING.md


Copyright and License

sl-ember-modelize and its source files are Copyright © 2014 SoftLayer Technologies, Inc. The software is MIT Licensed


Warranty

This software is provided “as is” and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.