DailyJS

fake-identity, Leaflet.FreeDraw

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

libraries graphics testing maps modules

fake-identity, Leaflet.FreeDraw

Posted by Alex R. Young on .
Featured

libraries graphics testing maps modules

fake-identity, Leaflet.FreeDraw

Posted by Alex R. Young on .

fake-identity

fake-identity (GitHub: travishorn / fake-identity, License: MIT, npm: fake-identity) by Travis Horn is a library for generating fake identities. You can use Identity.generate to create a single fake object, or Identity.generate(n) to get an array of n objects.

Here's an example of the output:

{
  firstName: "Amelia",
  lastName: "Wright",
  emailAddress: "awright@example.com",
  phoneNumber: "(555) 555-0155",
  street: "7327 Central Avenue",
  city: "Oxford",
  state: "TX",
  zipCode: "75045",
  dateOfBirth: Fri Jul 20 1962 00:00:00,
  sex: "female",
  company: "Contoso Pharmaceuticals",
  department: "Legal"
}

I find I have to do this quite often for testing. I usually use Faker to make users -- in fact, I had to do this very task today! I think fake-identity would have made my job easier in this case, because the schema I'm using is similar.

Leaflet.FreeDraw

Leaflet.FreeDraw

Leaflet.FreeDraw (GitHub: Wildhoney / Leaflet.FreeDraw, License: MIT) by Adam Timberlake is a library for Leaflet that adds support for creating polygons.

Use Leaflet.draw for drawing pre-defined polygons and linear shapes – Leaflet.FreeDraw's selling point is that it allows you to freely draw a polygon like Zoopla. Hulls are also supported to normalise polygons when users draw an insane polygon – currently Leaflet.FreeDraw supports Brian Barnett's Graham Scan module and my adaptation of the concave hull algorithm.

The readme is pretty solid, and explains how to handle polygon mutation, intersection, and elbow creation. The demo allows you to draw and edit polygons, with planes flying over the map.

I actually saw a similar polygon drawing UI widget on Ikea's solar panel quote page today. You can draw a polygon over your house so it can use the shape to estimate how well solar panels should work for your property.